-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: allow unaliased subqueries within UDFs #96375
Copy link
Copy link
Closed
Labels
A-sql-routineUDFs and Stored ProceduresUDFs and Stored ProceduresC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-queriesSQL Queries TeamSQL Queries Team
Description
There is a compatibility difference with postgres for queries with ambiguous columns.
Examples that fail in postgres with "subquery in FROM must have an alias" but not crdb:
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
SELECT * FROM (SELECT a FROM t1) JOIN (SELECT a FROM t2) ON true;
SELECT * FROM (SELECT * FROM (SELECT a FROM t1));
SELECT a FROM (SELECT * FROM (SELECT a FROM t1));
The following example fails correctly in crdb with "column reference "a" is ambiguous":
SELECT a FROM (SELECT * FROM (SELECT a FROM t1) JOIN (SELECT a FROM t2) ON true);
Jira issue: CRDB-24094
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-routineUDFs and Stored ProceduresUDFs and Stored ProceduresC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-queriesSQL Queries TeamSQL Queries Team
Type
Projects
Status
Done