Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently - Mailing list pgsql-bugs

From Dean Rasheed
Subject Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently
Date
Msg-id CAEZATCUszwWmc+d_rid5sB8k72S-V-DFbmKBDmQgHZj8RH6w_w@mail.gmail.com
Whole thread Raw
In response to Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-bugs
On Tue, 14 Feb 2023 at 11:29, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> I'm not sure that the location of the initialization is best.  My first
> impulse was to add it in line 3618, with the "Set global context" lines;
> but then I think it's possible for one tuple of a partition to be routed
> correctly and a later one that is concurrently updated suffer from an
> improper value in cpUpdateRetrySlot.
>

Hmm, shouldn't it be initialised in ExecMergeMatched(), before line
2896, making the CMD_DELETE case match the CMD_UPDATE case? Otherwise
maybe an update action could be matched initially, try a
cross-partition update, setting cpUpdateRetrySlot due to a concurrent
update, and then upon retrying, a delete action might match.

Regards,
Dean



pgsql-bugs by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently
Next
From: Alexander Bluce
Date:
Subject: Re: BUG #17782: ERROR: variable not found in subplan target lists