I have a function symbol_scan(integer) that returns a table with three columns: schema, table, count.
I can perform a selection query on it like this:
> SELECT name, symbol_scan(id), FROM symbols;
name | symbol_scan
------------------+--------------------------
MY_FIRST_SYMBOL | (public,random,1)
MY_SECOND_SYMBOL | (public,another_table,1)
UNIVERSAL | (public,international,5)
Is it possible to use another query such that the column names from symbol_scan(id) are extracted, such that the table looks like this?
name | schema | table | count
------------------+--------+---------------+-------
MY_FIRST_SYMBOL | public | random | 1
MY_SECOND_SYMBOL | public | another_table | 1
UNIVERSAL | public | international | 5
Is there a way to do this?
Note: If I run SELECT * FROM symbol_scan(1) I will of course get three columns, but I don’t know how to put the name in there, apart from putting it in the function itself.
You can do what you want on Postgres using this simple syntax: