Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash
Дата
Msg-id Y/P49Yov2m+VzfFf@paquier.xyz
обсуждение исходный текст
Ответ на BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
On Sat, Feb 18, 2023 at 08:00:00AM +0000, PG Bug reporting form wrote:
> INSERT INTO t VALUES (1), (2) ON CONFLICT(a)
>   DO UPDATE SET (a, b) = (SELECT t.a, t.b || '+');
>
> But when executing:
> UPDATE t SET (a, b) = (SELECT t.a, t.b || '+');
> I get:
> ERROR:  attribute 1 of type tp1 has wrong type
> DETAIL:  Table has type text, but query expects integer.

Reproduced here.

> By comparing two callstacks I can see that in the second case
> ExecInterpExprStillValid() is executed after the latest
> ExecEvalExprSwitchContext().
> The ExecInterpExprStillValid() function contains:
>         /* skip the check during further executions */
>         state->evalfunc = (ExprStateEvalFunc) state->evalfunc_private;
>
> If just call evalfunc_private() here, the first case ends with the error as
> expected.

Yeah, it would sound logic to me to have consistency with the
ExecEvalExprSwitchContext() checks here, so it seems like the executor
has missed the call for a long time.  Would you like to write a patch,
perhaps?  Did you bisect the origin of that?
--
Michael

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #17795: Erroneous parsing of floating-poing components in DecodeISO8601Interval()
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #17789: process_pgfdw_appname() fails for autovacuum workers