Re: Functions returning setof record -- can I use a table type as my return type hint?

Поиск
Список
Период
Сортировка
От George MacKerron
Тема Re: Functions returning setof record -- can I use a table type as my return type hint?
Дата
Msg-id 24C47454-4DE0-4793-8C63-24DA8A60F36B@lse.ac.uk
обсуждение исходный текст
Ответ на Re: Functions returning setof record -- can I use a table type as my return type hint?  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: Functions returning setof record -- can I use a table type as my return type hint?  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
On 12 Aug 2011, at 17:43, Merlin Moncure wrote:

> you can't have it both ways. at the time the function call is
> executed, the return type/fields must be known.  you can do this by
> either a. explicitly defining the function return type or b.
> describing the function return type in the function call, or c. use a
> generic type to hold the output record structure which can be
> parsed/dealt with later, like text or hstore.

Thanks.

I'm trying to do your option (a) -- defining the function return type.

But I want to do this by referring to an existing table type -- which I know the returned fields must match -- rather
thanlaboriously retype the field definition list for that table.  

The problem is that I can't make the database accept the table type as a field definition list, when that seems like a
perfectlysensible (and in this case much more convenient) way to define the fields that will be returned. 

(With apologies for thoughtless top-posting in reply to Ray's earlier message).

Please access the attached hyperlink for an important electronic communications disclaimer:
http://lse.ac.uk/emailDisclaimer

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

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: Functions returning setof record -- can I use a table type as my return type hint?
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: COPY from .csv File and Remove Duplicates