TABLE() v12
Use the TABLE()
function to transform the members of an array into a set of rows. The signature is:
TABLE(<collection_value>)
Where:
collection_value
collection_value
is an expression that evaluates to a value of collection type.
The TABLE()
function expands the nested contents of a collection into a table format. You can use the TABLE()
function anywhere you use a regular table expression.
The TABLE()
function returns a SETOF ANYELEMENT
(a set of values of any type). For example, if the argument passed to this function is an array of dates, TABLE()
will return a SETOF dates
. If the argument passed to this function is an array of paths, TABLE()
will return a SETOF paths
.
You can use the TABLE()
function to expand the contents of a collection into table form:
postgres=# SELECT * FROM TABLE(monthly_balance(445.00, 980.20, 552.00)); monthly_balance ---------------- 445.00 980.20 552.00 (3 rows)