On Wed, Oct 12, 2011 at 1:43 PM, J.V. <jvsrvcs@gmail.com> wrote:
> I tried hstore with no luck.
>
> How do I initialize the array?
>
> How do I loop through each key/value pair in a stored function to retrieve
> the key and value for each item in the list?
>
> I need a list of key value pairs. Any options there?
it's all in the docs:
postgres=# select * from each(hstore(ARRAY['a','b'], ARRAY['1','2']));
key | value
-----+-------
a | 1
b | 2
(2 rows)
dont see what's so hard 'bout that. 9.0+ hstore is superior to the
composite type method in every way I can think of unless you are
storing explictly non text value in the type and you are not
transferring the compacted list to the client. hstore is much more
flexible in terms of getting data in/out, searching, etc. as a bonus
you have gist indexing if you need it, etc etc.
merlin