Peter Eisentraut wrote:
* Using an array as a table source using UNNEST, something like:

select * from unnest(test.b);
(Check the exact spec to be sure; clause 7.6.)

select * from unnest(array['a','b']); ?column? ---------- a b

select * from unnest(array['a','b']) WITH ORDINALITY;
 ?column? | ?column?
----------+----------
 1        | a
 2        | b

select * from unnest(array['a','b']) as t(f1, f2) WITH ORDINALITY;
 f1 | f2
----+----
 1  | a
 2  | b

The WITH ORDINALITY goes before the AS clause.


The reason it is defined in terms of the LATERAL clause is that that
allows you to refer to column aliases defined in FROM items to its left.
This is the way variable arguments of function calls as table sources can
be resolved.  (At least this is my interpretation.  I found some examples
on the web a few months ago about this.)


If I can get this done *without* supporting LATERAL by the end of the evening (i.e. just implement the examples), would it possibly be accepted? Or should UNNEST wait until we get LATERAL?


Joe




---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings

Reply via email to