Re: BUG #17689: Two UPDATE operators in common table expressions (CTE) perform not as expected - Mailing list pgsql-bugs

From Marko Tiikkaja
Subject Re: BUG #17689: Two UPDATE operators in common table expressions (CTE) perform not as expected
Date
Msg-id CAL9smLDd7kvT9xCpOUFwNcvEaz_zsmua8XpuR5Pd6wBdaP33bA@mail.gmail.com
Whole thread Raw
In response to BUG #17689: Two UPDATE operators in common table expressions (CTE) perform not as expected  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17689: Two UPDATE operators in common table expressions (CTE) perform not as expected  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-bugs
This is a documented limitation:

> Trying to update the same row twice in a single statement is not supported. Only one of the modifications takes
place,but it is not easy (and sometimes not possible) to reliably predict which one. This also applies to deleting a
rowthat was already updated in the same statement: only the update is performed. Therefore you should generally avoid
tryingto modify a single row twice in a single statement. In particular avoid writing WITH sub-statements that could
affectthe same rows changed by the main statement or a sibling sub-statement. The effects of such a statement will not
bepredictable. 

https://www.postgresql.org/docs/current/queries-with.html


.m



pgsql-bugs by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: WAL segments removed from primary despite the fact that logical replication slot needs it.
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #17689: Two UPDATE operators in common table expressions (CTE) perform not as expected