sql,opt: composite_value
and composite_value.*
should be identical in some contexts (e.g. as a function argument)
#60549
Labels
A-sql-builtins
SQL built-in functions and semantics thereof.
A-sql-name-resolution
SQL name resolution rules and CTEs.
A-sql-pgcompat
Semantic compatibility with PostgreSQL
A-tools-graphile
Issues relating to graphile compatibility
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
The syntax
select row_to_json(x) from my_table x
is not supported. CockroachDB assumesx
is a column rather than a table reference. A workaround is to useselect row_to_json(x.*) from my_table x
.Tools like PostGraphile use this. See graphile/crystal#645 (comment)
The PostgreSQL docs explain more: https://www.postgresql.org/docs/13/rowtypes.html
It seems like we need to update
cockroach/pkg/sql/opt/optbuilder/scope.go
Lines 923 to 928 in 0c4fc8e
Right now,
t.NormalizeVarName
returns either atree.AllColumnsSelector
or atree.ColumnItem
. Currently it decides that based solely on if there is a star expansion in the expression. Perhaps it should be updated to returntree.AllColumnsSelector
according to the rules above.Relates to:
The text was updated successfully, but these errors were encountered: