Re: functions are returns columns

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: functions are returns columns
Дата
Msg-id 21435.1194736490@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: functions are returns columns  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-sql
Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> Not quite --- it's just "returns setof record".

> I did test my example before posting it:

> postgres=# postgres=# CREATE or replace FUNCTION getfoo (IN int, OUT int, OUT int) returns setof record(int,int)AS
$$
>    SELECT 1,2 union all select 2,3;
> $$ LANGUAGE SQL;

Interesting --- if you try it in anything older than 8.3, it will fail.

What is happening here is that the "(int,int)" is being taken as a
typmod (per Teodor's work to allow typmods for all data types), and
apparently in this path we never check to see if it's a *valid* typmod.

Now typmods are always discarded from function argument and result
types, but it seems like we'd better validate that they're legal for the
datatype anyway.  Otherwise there will be confusion of just this sort.

Comments, objections?
        regards, tom lane


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

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: functions are returns columns
Следующее
От: chester c young
Дата:
Сообщение: general question on optimizer