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
release-21.1: sql: fix ColumnAccessExpr.Eval with NULL inner expression #79527
Conversation
Previously, `ColumnAccessExpr.Eval` would panic if the `ColumnAccessExpr`'s inner expression evaluated to `NULL`, because it attempted to cast this `NULL` to a `DTuple`. Now, if the inner expression is `NULL`, `ColumnAccessExpr.Eval` returns `NULL`. Fixes #78159 Release note (bug fix): A bug has been fixed that caused an internal error when the inner expression of a column access expression evaluated to `NULL`. For example, evaluation of the expression `(CASE WHEN b THEN ((ROW(1) AS a)) ELSE NULL END).a` would error when `b` is `false`. This bug has been present since version 19.1 or earlier.
…pleExprs Previously, an expression that produced a tuple from several potential values was typed as a tuple without any labels. This prevented a tuple's column to be accessed by a label name. For example, the expression below would result in the error "could not identify column 'a' in record data type". SELECT (CASE WHEN true THEN (ROW(1) AS a) ELSE (ROW(2) AS a) END).a Now, the labels of the first tuple are used in the type of the outer expression. Fixes #78515 Release note (bug fix): A bug has been fixed that caused an error when accessing a named column of a labelled tuple. The bug only occurred when an expression could produce one of several different tuples. For example, `(CASE WHEN true THEN (ROW(1) AS a) ELSE (ROW(2) AS a) END).a` would fail to evaluate. This bug was present since version 22.1.0. Although present in previous versions, it was impossible to encounter due to limitations that prevented using tuples in this way.
90d0361
to
d3fbe5f
Compare
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
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.
Reviewed 2 of 2 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @msirek)
Backport 2/2 commits from #78423 on behalf of @mgartner.
/cc @cockroachdb/release
sql: fix ColumnAccessExpr.Eval with NULL inner expression
Previously,
ColumnAccessExpr.Eval
would panic if theColumnAccessExpr
's inner expression evaluated toNULL
, because itattempted to cast this
NULL
to aDTuple
. Now, if the innerexpression is
NULL
,ColumnAccessExpr.Eval
returnsNULL
.Fixes #78159
Release note (bug fix): A bug has been fixed that caused an internal
error when the inner expression of a column access expression evaluated
to
NULL
. For example, evaluation of the expression(CASE WHEN b THEN ((ROW(1) AS a)) ELSE NULL END).a
would error whenb
isfalse
. This bug has been present since version 19.1 or earlier.sql: include tuple labels in types returned from typeCheckSameTypedTupleExprs
Previously, an expression that produced a tuple from several potential
values was typed as a tuple without any labels. This prevented a tuple's
column to be accessed by a label name.
For example, the expression below would result in the error "could not
identify column 'a' in record data type".
Now, the labels of the first tuple are used in the type of the outer
expression.
Fixes #78515
Release note (bug fix): A bug has been fixed that caused an error when
accessing a named column of a labelled tuple. The bug only occurred when
an expression could produce one of several different tuples. For
example,
(CASE WHEN true THEN (ROW(1) AS a) ELSE (ROW(2) AS a) END).a
would fail to evaluate. This bug was present since version 22.1.0.
Although present in previous versions, it was impossible to encounter
due to limitations that prevented using tuples in this way.
Release justification: Minor bug fix.