Re: [GENERAL] RETURNS SETOF RECORD with 1 column

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] RETURNS SETOF RECORD with 1 column
Дата
Msg-id 26650.1501251534@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [GENERAL] RETURNS SETOF RECORD with 1 column  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Ответы Re: [GENERAL] RETURNS SETOF RECORD with 1 column
Список pgsql-general
Vincenzo Romano <vincenzo.romano@notorand.it> writes:
> I would like to understand the typo protection mentioned by Tom earlier:
> I need to understand the reason for creating that special case.

Well, case A:

create function foo(out x int4) returns setof int8 ...

This is indubitably a typo.

Case B:

create function foo(out x record) returns setof record ...

Now what?  Is the user expecting us to wrap x in an additional
layer of composite, or not?  Our current assumption is "not",
but it would be pretty inconsistent to do that if x did get
wrapped as long as it were any other type.

Yes, we could have resolved that ambiguity in one direction or the
other and then said that "returns record" or "returns setof record"
is OK regardless of the number of OUT parameters, but we didn't.
Considering that the SQL-standard syntax for this is TABLE(), and that
hasn't got these issues in the first place, I don't feel any need to
revisit the question.

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] tzdata version
Следующее
От: Timokhin Maxim
Дата:
Сообщение: Re: [GENERAL] duplicate key value violates unique constraint and duplicated records