-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: tuple expansion of table in udfs fails with "column...does not exist" #97602
Copy link
Copy link
Closed
Closed
Copy link
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.S-3Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)T-sql-queriesSQL Queries TeamSQL Queries Team
Description
In postgres, we can expand tables as tuples:
create table t (a int, b int);
insert into t values (1,2),(3,4);
select (t).* from t;
a | b
---+---
1 | 2
3 | 4
create function f() returns setof record language sql begin atomic; select (t).* from t; end;
select f();
f
-------
(1,2)
(3,4)
In CRDB, we can expand tables this way outside of UDFs, but not inside UDFs:
select (t).* from t;
a | b
----+----
1 | 2
3 | 4
create function f() returns setof record language sql as $$ select
-> (t).* from t; $$;
ERROR: column "t" does not exist
Jira issue: CRDB-24776
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.S-3Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)T-sql-queriesSQL Queries TeamSQL Queries Team
Type
Projects
Status
Done