Using arrays makes it a little less verbose and easier to manage IMO.

SELECT v FROM unnest(array['a','b','c','d']) v


Is that 8.4? or is unnest from contrib/ ?

thanks!

Dave

Unnest is included in 8.4, but it's pretty much essential for working with arrays. Pre 8.4, you'd add the function like so

CREATE OR REPLACE FUNCTION unnest(anyarray)
  RETURNS SETOF anyelement AS
$BODY$
SELECT $1[i] FROM
    generate_series(array_lower($1,1),
                    array_upper($1,1)) i;
$BODY$
  LANGUAGE 'sql' IMMUTABLE STRICT

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to