Re: PL/PGSQL bug in handling composite types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PL/PGSQL bug in handling composite types
Дата
Msg-id 22674.1335413878@sss.pgh.pa.us
обсуждение исходный текст
Ответ на PL/PGSQL bug in handling composite types  (Boszormenyi Zoltan <zb@cybertec.at>)
Список pgsql-hackers
Boszormenyi Zoltan <zb@cybertec.at> writes:
> we have found a way to make pl/pgsql throw an error for
> a legitimate use case that works in plain SQL.

The fact that it doesn't work the way you thought doesn't make it a bug.

plpgsql expects an assignment "INTO row_variable" to be supplied from
one select column per field in the composite variable.  So instead of
executing 'select (max(id),min(d))::mytype from x1', try executing
'select max(id),min(d) from x1'.

If we were to change this, we would break a lot of existing plpgsql
code; or, if we tried to support both usages, we would create nasty
semantic ambiguities for single-column composites.  Possibly the
documentation in "39.5.3. Executing a Query with a Single-row Result"
could be improved though.  To my eyes, it does say that this is what
happens, but it doesn't really emphasize the point that the SELECT's
output has to be "exploded" not delivered as a single composite column.
        regards, tom lane


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

Предыдущее
От: Noah Misch
Дата:
Сообщение: Re: psql omits row count under "\x auto"
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Temporary tables under hot standby