Skip to content

sql: tuple star expansion in tuple context should flatten #28203

@knz

Description

@knz

Found by @jordanlewis while reviewing #28151 / #28143.

In postgres:

jordan=# SELECT ((i.keys).*, 123) FROM (SELECT information_schema._pg_expandarray(ARRAY[3,2,1]) AS keys) AS i;
    row
-----------
 (3,1,123)
 (2,2,123)
 (1,3,123)

In CockroachDB this gets us:

 ((3,1),123)
 ((2,2),123)
 ((1,3),123)

This is incorrect - the tuple should be flattened.

Jira issue: CRDB-4921

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sql-optimizerSQL logical planning and optimizations.A-sql-pgcompatSemantic compatibility with PostgreSQLA-sql-semanticsC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.S-3-erroneous-edge-caseDatabase produces or stores erroneous data without visible error/warning, in rare edge cases.T-sql-queriesSQL Queries Team

    Type

    No type

    Projects

    Status

    Bugs to Fix

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions