Re: Seeking Clarification on Function Definitions in PostgreSQL Extensions

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Seeking Clarification on Function Definitions in PostgreSQL Extensions
Дата
Msg-id CAKFQuwYUBCqsCS85yvHGkvWBtfxUWFJiTQ9MppUNa5RVitD7ew@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Seeking Clarification on Function Definitions in PostgreSQL Extensions  (Ayush Vatsa <ayushvatsa1810@gmail.com>)
Список pgsql-general
On Wednesday, June 19, 2024, Ayush Vatsa <ayushvatsa1810@gmail.com> wrote:
Hi David,
Thanks for clarification
I prefer TABLE.  Using setof is more useful when the returned type is predefined
But in the table also isn't the returned type predefined? Example:
CREATE FUNCTION fun1(integer)
RETURNS TABLE(
        col1 integer,
        col2 text
)
AS 'MODULE_PATHNAME', 'fun1'
LANGUAGE C;
We know the returned type will have two columns with type -  integer and text. Am I correct?

Sorry, predefined independently of the function.  Using create type then referring to that type by name in the create function.
 

Or a true record where the caller has to specify the shape.
Sorry but didn't get this shape part?

… from rec_func as (col1 isn’t, col2 text) …

The shape is two columns, type int and text respectively.

David J.

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

Предыдущее
От: Ayush Vatsa
Дата:
Сообщение: Re: Seeking Clarification on Function Definitions in PostgreSQL Extensions
Следующее
От: Ron Johnson
Дата:
Сообщение: Re: Manual Failover