Re: Error in PLpgSQL with SELECT INTO and composite types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Error in PLpgSQL with SELECT INTO and composite types
Дата
Msg-id 18545.1236980531@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Error in PLpgSQL with SELECT INTO and composite types  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-bugs
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
>    SELECT '("(1)")'::btype INTO bvar;  -- Should work, but errors

No, because it's expecting the SELECT to yield a separate column for
each column of the composite variable bvar.  Something like

SELECT ('("(1)")'::btype).* INTO bvar;

would be correct.  To make it work the way you're thinking would break
a lot of code that expects the existing semantics --- instead of

select expr1, expr2 into two_column_record_var from ...

people would have to write something like

select row(expr1, expr2) into two_column_record_var from ...

            regards, tom lane

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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Error in PLpgSQL with SELECT INTO and composite types
Следующее
От: "Roman Kononov"
Дата:
Сообщение: BUG #4702: refusal to compute date_trunc('week', '0001-12-09 BC');