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

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема How hard would it be to support LIKE in return declaration of generic record function calls ?
Дата
Msg-id 1335958834.3106.454.camel@hvost
обсуждение исходный текст
Ответы Re: How hard would it be to support LIKE in return declaration of generic record function calls ?  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Hi Hackers

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);

ERROR:  syntax error at or near "like"

instead of explicitly spelling out the structure of table test2 in the
AS part.

insert into test2 
select * from json_to_record(jrec json)                        as (id int, data2 test, tstamp timestamp);
INSERT 0 1


PS.

As a pie-in-the-sky wish I'd prefer of course even simpler syntax of

insert into test2 json_to_record(jrec json);

or at least  

insert into test2 json_to_record(jrec json)::test2;

:)
- 
-------
Hannu Krosing
PostgreSQL Unlimited Scalability and Performance Consultant
2ndQuadrant Nordic
PG Admin Book: http://www.2ndQuadrant.com/books/



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

Предыдущее
От: Jeroen Vermeulen
Дата:
Сообщение: Re: extending relations more efficiently
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Have we out-grown Flex?