Re: BUG #17689: Two UPDATE operators in common table expressions (CTE) perform not as expected

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Marko Tiikkaja <marko(at)joh(dot)to>, eugene(dot)pliskin(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17689: Two UPDATE operators in common table expressions (CTE) perform not as expected
Date: 2022-11-18 22:50:59
Message-ID: CAKFQuwafaEY67W_fc52jozySACBW9fECAnKWFuZTqg4=H8GYAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Nov 18, 2022 at 11:53 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > On 2022-Nov-18, Marko Tiikkaja wrote:
> >> This is a documented limitation:
> >>> Trying to update the same row twice in a single statement is not
> >>> supported.
>
> > I wonder if we should try to detect the case, and raise an error instead
> > of it resulting in undefined behavior.
>
> My recollection is that that is really fallout from an ancient and
> intentional executor behavior, that we have to ignore multiple updates
> in order to not get into infinite loops. See comment about the
> "Halloween problem" in nodeLockRows.c. (I'm pretty sure there were once
> more comments about that, somewhere closer to ExecUpdate/ExecDelete ---
> this all dates back to Berkeley.)
>
>
I'm not really sure I'd want to change the behavior to perform multiple
updates even if we could. But in a green field development I would prefer
the error. Right now I'd side with introducing an error as well.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2022-11-19 12:44:09 BUG #17691: Unexpected behaviour using ts_headline()
Previous Message PG Bug reporting form 2022-11-18 19:21:05 BUG #17690: Nonresponsive client on replica can halt replication indefinitely