-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: support missing JSON numeric scalar casts #41333
Labels
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
good first issue
Comments
jordanlewis
added
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
good first issue
labels
Oct 4, 2019
I would like to work on this. |
@97amarnathk I think @chrisseto has an ongoing patch for this. I'll assign him to prevent confusion. |
Okay. |
chrisseto
added a commit
to chrisseto/cockroach
that referenced
this issue
Oct 6, 2019
* Fixes cockroachdb#41333 * Add support for queries such as - `SELECT '1'::jsonb::int` - `SELECT '1'::jsonb::float` - `SELECT '3.14'::jsonb::decimal` Release note: None
craig bot
pushed a commit
that referenced
this issue
Feb 12, 2021
41367: sql: Add support for numeric JSON scalar casts r=rafiss a=chrisseto * Fixes #41333 * Add support for queries such as - `SELECT '1'::jsonb::int` - `SELECT '1'::jsonb::float` - `SELECT '3.14'::jsonb::decimal` Release note (sql change): Casting JSON numeric scalars to numeric types now works as expected. Co-authored-by: Chris Seto <chriskseto@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
good first issue
It should be possible to cast JSON scalars to their corresponding SQL types, but it currently is not possible.
We should support:
JSON numeric -> int
JSON numeric -> float
JSON numeric -> decimal
JSON numeric -> string
This change should be pretty straightforward -
CastExpr.Eval
should be edited ineval.go
to add the missing cases, and tests added topkg/sql/sem/tree/testdata/eval/cast
.The text was updated successfully, but these errors were encountered: