Skip to content

Accept ROW(...) as a SQL-standard alias for Tuple(...)#106265

Open
shreyasganesh0 wants to merge 1 commit into
ClickHouse:masterfrom
shreyasganesh0:feature/row-tuple-type-alias
Open

Accept ROW(...) as a SQL-standard alias for Tuple(...)#106265
shreyasganesh0 wants to merge 1 commit into
ClickHouse:masterfrom
shreyasganesh0:feature/row-tuple-type-alias

Conversation

@shreyasganesh0

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Accept ROW(name type, ...) as a SQL-standard alias for Tuple(name type, ...) in type expressions (CAST, column DDL), for PostgreSQL compatibility.

Documentation entry for user-facing changes

Closes #105954.

ROW(...) is now accepted anywhere a type is expected, as a case-insensitive alias for Tuple(...):

SELECT CAST((1, 'a') AS ROW(x INTEGER, y VARCHAR(10)));
CREATE TABLE t (r ROW(id INTEGER, name String)) ENGINE = Memory;

Implemented as a single registerAlias("ROW", "Tuple", Case::Insensitive) in registerDataTypeTuple, mirroring the existing NUMERICDecimal / INTEGERInt32 aliases. Named-element access on the resulting tuple already works. Covered by a new stateless test 04299_row_tuple_type_alias.

Register ROW as a case-insensitive type-family alias for Tuple so that
standard-SQL / PostgreSQL spellings such as

    CAST((1, 'a') AS ROW(x INTEGER, y VARCHAR(10)))
    CREATE TABLE t (r ROW(id INTEGER, name VARCHAR(20))) ENGINE = Memory

are accepted, mirroring the existing INTEGER->Int32 / NUMERIC->Decimal
aliases. Named-element access on the resulting tuple already works.

Closes ClickHouse#105954.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accept ROW(name type, …) as an alias for Tuple(name type, …) in type expressions

1 participant