Re: How hard would it be to support LIKE in return declaration of generic record function calls ?

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: How hard would it be to support LIKE in return declaration of generic record function calls ?
Дата
Msg-id CAHyXU0x1_9ZUxnu+B3iFrbmDSDFbHFp5z+7MZiseYQw2MZHs_Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How hard would it be to support LIKE in return declaration of generic record function calls ?  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: How hard would it be to support LIKE in return declaration of generic record function calls ?  (Hannu Krosing <hannu@2ndQuadrant.com>)
Список pgsql-hackers
On Wed, May 2, 2012 at 12:06 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On ons, 2012-05-02 at 13:40 +0200, Hannu Krosing wrote:
>> How hard would it be to add support for LIKE syntax, similar to table
>> def in field list declaration for generic record functions
>>
>> What I'dd like to be able to do is to have a generic json_to_record
>> function
>>
>> CREATE OR REPLACE RECORD json_to_record(json) RETURNS RECORD AS $$
>> ...
>> $$ LANGUAGE ... ;
>>
>> and then be able to call it like this
>>
>> insert into test2
>> select * from json_to_record(jrec json) as (like test2);
>
> That would be very useful, and shouldn't be too hard to implement.  (I
> had to look about three times to understand what this was supposed to
> achieve, but I think the syntax is the right one after all.)

Although I like the functionality, is this better than the trick used
by hstore/populate_record?  That approach doesn't require syntax
changes and allows you to execute the function without 'FROM'.

merlin


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: PL/Python result set slicing broken in Python 3
Следующее
От: Daniel Farina
Дата:
Сообщение: Modeling consumed shmem sizes, and some thorns