Re: Bug with FOR ... LOOP and composite types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug with FOR ... LOOP and composite types
Дата
Msg-id 21527.1220285106@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Bug with FOR ... LOOP and composite types  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Список pgsql-bugs
"Pavel Stehule" <pavel.stehule@gmail.com> writes:
> 2008/9/1 Oleg Serov <serovov@gmail.com>:
>> Seems there is an error when I try to use a table with one field - composite
>> type, when SELECT QUERY in FOR ... LOOP instruction returns empty result.

> ROWTYPE is problem.

I think it actually is a bug.  exec_for_query tries to set the target to
null this way:

        exec_move_row(estate, rec, row, NULL, tuptab->tupdesc);

and exec_move_row thinks it doesn't have to present a valid "valtype"
to exec_assign_value when it's assigning a made-up null, and that fails
when the target is of PLPGSQL_DTYPE_ROW type (looks like it'd fail for
REC type too, but ROW is the case here).

We could work around the particular issue by moving the
type_is_rowtype() tests down so they're not done for a null source
value, but I think that's just a hack.  A cleaner fix would be to teach
exec_move_row to present the correct column type in all cases.

            regards, tom lane

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

Предыдущее
От: "could not reattach to shared memory"
Дата:
Сообщение: BUG #4389: FATAL: could not reattach to shared memory (key=1804, addr=018E0000): 487
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bug in RETURN QUERY