-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: fix internal error when trying to parse strings as arrays #52416
sql: fix internal error when trying to parse strings as arrays #52416
Conversation
pkg/sql/sem/tree/constant.go
Outdated
func typeCheckConstant( | ||
ctx context.Context, semaCtx *SemaContext, c Constant, desired *types.T, | ||
) (ret TypedExpr, err error) { | ||
avail := c.AvailableTypes() | ||
if desired.Family() != types.AnyFamily { | ||
if isDefiniteType(desired) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a function typ.IsAmbiguous
that does something like this already
The parse-constant-as-type code was allowing a desired type of `Array[Any]`, and we can't parse elements as `Any`. This resulted in an internal error, rather than a normal query error. Fixes cockroachdb#52134. Release note (bug fix): Fixed an internal error involving string literals used as arrays.
4d7b314
to
32522ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @otan and @rohany)
pkg/sql/sem/tree/constant.go, line 79 at r1 (raw file):
Previously, rohany (Rohan Yadav) wrote…
I think we have a function
typ.IsAmbiguous
that does something like this already
Awesome!! Done.
bors r+ |
Build failed: |
bors r+ |
Build succeeded: |
The parse-constant-as-type code was allowing a desired type of
Array[Any]
, andwe can't parse elements as
Any
. This resulted in an internal error, ratherthan a normal query error.
Fixes #52134.
Release note (bug fix): Fixed an internal error involving string literals used
as arrays.