Closed lovasoa closed 4 days ago
From https://www.postgresql.org/docs/17/queries-table-expressions.html#QUERIES-TABLEFUNCTIONS :
In some cases it is useful to define table functions that can return different column sets depending on how they are invoked. To support this, the table function can be declared as returning the pseudo-type record with no OUT parameters. When such a function is used in a query, the expected row structure must be specified in the query itself, so that the system can know how to parse and plan the query. This syntax looks like:
function_call [AS] alias (column_definition [, ... ])
function_call AS [alias] (column_definition [, ... ])
ROWS FROM( ... function_call AS (column_definition [, ... ]) [, ... ] )
Postgres supports specifying column names AND types in a table alias (after AS) for functions that return values of type "record".
The following syntax is valid in postgres
But in sqlparser, it returns
This was initially reported in SQLPage, as: https://github.com/sqlpage/SQLPage/discussions/690