sql-metadata icon indicating copy to clipboard operation
sql-metadata copied to clipboard

table function support

Open niyue opened this issue 4 years ago • 0 comments

Postgres supports table function (SQL server supports it as well), currently, the usage of table function is not supported. For some examples:

  1. table function with table alias
SELECT 
  m.id
FROM
  my_func() m
  • parser.columns is expected to return ['my_func.id'], but currently it returns ['m.id']
  • parser.tables_aliases is expected to return {'m': 'my_func'}, but currently it returns {}
  1. table function in parameterized statement
SELECT
  m.id
FROM 
  my_func(?) m

parser.tables is expected to return ['my_func'], but currently it returns ['?', 'my_func']

  • References
    • postgres table function, https://www.postgresql.org/docs/7.3/xfunc-tablefunctions.html
    • SQL server table valued function, https://www.sqlservertutorial.net/sql-server-user-defined-functions/sql-server-table-valued-functions/

niyue avatar Dec 17 '21 05:12 niyue