Re: how to key/value iterate in stored function

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: how to key/value iterate in stored function
Дата
Msg-id CAHyXU0x6Z4rRtybZe+L7_mJ8O1JxKV5u31pv9Y0dXmLL2F9KDQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: how to key/value iterate in stored function  ("J.V." <jvsrvcs@gmail.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Bob Hatfield
Дата:
Сообщение: Re: Are file system level differential/incremental backups possible?
Следующее
От: Andy Colson
Дата:
Сообщение: Re: PostGIS: Approximating a house number from street address range