Skip to content

sql: tuple expansion of table in udfs fails with "column...does not exist" #97602

@rharding6373

Description

@rharding6373

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sql-routineUDFs and Stored ProceduresC-bugCode 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)T-sql-queriesSQL Queries Team

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions