On Thu, Oct 20, 2011 at 1:53 PM, J.V. <jvsr...@gmail.com> wrote:
> Does anyone have a specific example of how to:
>    1) create a variable that is a set or array of key value pairs?
>    2) how to populate each element of the array (each element being a key /
> value pair)
>    3) how to iterate through the list or array retrieving each key/value
> pair?

create type pair_t as (key text, value text);

select array[('a', '123'), ('b', '234')]::pair_t[];

select (unnest(array[('a', '123'), ('b', '234')]:: pair_t[])).*;

merlin

-- 
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