Re: Is a function to a 1-component record type undeclarable?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Is a function to a 1-component record type undeclarable?
Дата
Msg-id 3740439.1637597723@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Is a function to a 1-component record type undeclarable?  (Chapman Flack <chap@anastigmatix.net>)
Ответы Re: Is a function to a 1-component record type undeclarable?  (Chapman Flack <chap@anastigmatix.net>)
Список pgsql-hackers
Chapman Flack <chap@anastigmatix.net> writes:
> The same declaration can be changed to have just one OUT parameter:

> CREATE FUNCTION dup(in int, out f text)
>     AS $$ SELECT CAST($1 AS text) || ' is text' $$
>     LANGUAGE SQL;

> But it then behaves as a function returning a text scalar, not a record.

Yup, that's intentional, and documented.  It seems more useful to allow
you to declare a scalar-returning function in this style, if you wish,
than to make it mean a one-component record.  If you really want a
one-component composite type, you can declare such a type explicitly
and return that.

            regards, tom lane



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

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: Re: logical decoding and replication of sequences
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Isn't it better with "autovacuum worker...." instead of "worker took too long to start; canceled" specific to "auto