Skip to content

Allow table name as column reference to return row as struct#4195

Draft
arnaud-lacurie wants to merge 7 commits into
FoundationDB:mainfrom
arnaud-lacurie:foo_from_foo
Draft

Allow table name as column reference to return row as struct#4195
arnaud-lacurie wants to merge 7 commits into
FoundationDB:mainfrom
arnaud-lacurie:foo_from_foo

Conversation

@arnaud-lacurie
Copy link
Copy Markdown
Collaborator

@arnaud-lacurie arnaud-lacurie commented May 22, 2026

Summary

  • When an identifier in the SELECT list matches a table name or alias but no column with that name exists, return the full row as a struct (equivalent to SELECT (*) FROM <table>)
  • Column names always take priority over table names
  • Alias form (SELECT t FROM foo t) works as expected

Implementation

Added resolveAsTableRowMaybe in SemanticAnalyzer as a fallback in resolveIdentifier — reuses the existing expandStar path, same as SELECT (T.*).

Updated SELECT reference docs to cover (*) and the new shorthand, which were previously undocumented.

Built on top of #4182

…ource

SELECT (T.*) now names the outer column after T; SELECT (*) from a single
table names it after the table/alias.  With multiple tables in scope the
column remains anonymous.
When an identifier in the SELECT list matches a table name or alias but
no column with that name exists, return the full row as a struct —
equivalent to SELECT (*) FROM <table>. Column names always take priority
over table names.

SELECT restaurant FROM restaurant;
SELECT r FROM restaurant r;
@arnaud-lacurie arnaud-lacurie added the enhancement New feature or request label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant