Re: proposal: plpgsql - iteration over fields of rec or row variable
От | Dmitriy Igrishin |
---|---|
Тема | Re: proposal: plpgsql - iteration over fields of rec or row variable |
Дата | |
Msg-id | AANLkTi=Vxi=34KiHY2=EFpY4yTXZwXZPZ38Q-FEeOOsk@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: proposal: plpgsql - iteration over fields of rec or row variable ("David E. Wheeler" <david@kineticode.com>) |
Ответы |
Re: proposal: plpgsql - iteration over fields of rec or row variable
|
Список | pgsql-hackers |
Hey David,
2010/11/9 David E. Wheeler <david@kineticode.com>
--
// Dmitriy.
2010/11/9 David E. Wheeler <david@kineticode.com>
On Nov 9, 2010, at 1:38 AM, Dmitriy Igrishin wrote:You realize you can pretty much do all this with hstore, right?
> * 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);
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);
Yep, but hstore is an additional module. Although, its not a problem.
Best,
David
--Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
--
// Dmitriy.
В списке pgsql-hackers по дате отправления: