From: Michael Paquier <michael@paquier.xyz>
To: exclusion@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash
Date: Tue, 21 Feb 2023 07:49:25 +0900
Message-ID: <Y/P49Yov2m+VzfFf@paquier.xyz> (raw)
In-Reply-To: <17800-ff90866b3906c964@postgresql.org>
References: <17800-ff90866b3906c964@postgresql.org>
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
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash
In-Reply-To: <Y/P49Yov2m+VzfFf@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox