Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
78423: sql: fix ColumnAccessExpr.Eval with NULL inner expression r=mgartner a=mgartner #### sql: fix ColumnAccessExpr.Eval with NULL inner expression 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. #### 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". 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. Co-authored-by: Marcus Gartner <[email protected]>
- Loading branch information