Re: proposal: plpgsql - iteration over fields of rec or row variable

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: proposal: plpgsql - iteration over fields of rec or row variable
Дата
Msg-id D12B40B8-48B4-44EF-B1EC-14E296BD248A@kineticode.com
обсуждение исходный текст
Ответ на Re: proposal: plpgsql - iteration over fields of rec or row variable  (Dmitriy Igrishin <dmitigr@gmail.com>)
Ответы Re: proposal: plpgsql - iteration over fields of rec or row variable  (Dmitriy Igrishin <dmitigr@gmail.com>)
Re: proposal: plpgsql - iteration over fields of rec or row variable  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: proposal: plpgsql - iteration over fields of rec or row variable  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On Nov 9, 2010, at 1:38 AM, Dmitriy Igrishin wrote:

> * text[] = record_to_array(record)
> * table(id, key, datatype, value) = record_to_table(record)
> * text = record_get_field(record, text)
> * record = record_set_field(record, text, anyelement)
> 
> ??
> I personally like it. But I propose to add as well:
>   integer := record_nkeys();
>   text := record_get_field(record, integer);

You realize you can pretty much do all this with hstore, right?
 hstore hash := hstore(record); ary    text[] := hstore_to_matrix(hash); select * from each(hash); -- TABLE text foo :=
hash-> somekey; hash := hash || '"key","value"'::hstore; record := populate_record(record, hash);
 

Best,

David



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

Предыдущее
От: Aidan Van Dyk
Дата:
Сообщение: Re: Protecting against unexpected zero-pages: proposal
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Protecting against unexpected zero-pages: proposal