Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNbIE-00DiP6-6w for pgsql-general@arkaria.postgresql.org; Wed, 10 Jan 2024 16:19:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rNbID-005Zvp-AT for pgsql-general@arkaria.postgresql.org; Wed, 10 Jan 2024 16:19:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNbIC-005Zvg-Vr for pgsql-general@lists.postgresql.org; Wed, 10 Jan 2024 16:19:01 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNbIA-000rlD-Fv for pgsql-general@postgresql.org; Wed, 10 Jan 2024 16:18:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2024010820; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=jRKkS0bZ+lDuHM3lqeINAQ9KMPcv4FTuSt/zSeI2v5I=; b=Z+fUB Avcd2g1Wo7xYy5XnT+zaFGlqBrnJ7KeoiWqIk68V9OEbTz4S/JOUWXxomkBvKniv9G1O3rIj9PcXg 9md2AOVZNQ0WS4zMUUtFpHc1m5qz2Ev26+3a0ElYnnLQM4g/C+nNmaTzZz8l4hcjKynRHwuZRygYf xBfI1ujCeEoqs9+l+bo+urwCXEAAVhywTULV5xdB+qDD3CTU36A0miw7J09b3BGAInGglfqVOyNq5 CNwYdy0t/Qxl342uMcN1Mp+WIpAPyj6aiOBH7r1q7X3x1sSjXgMvfYFeCgIlvzMsHqk/WwRMu48G5 3gRzPsmBX5lFMEnDyecGmhCULPVxA==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1rNbI9-002gig-1s; Wed, 10 Jan 2024 11:18:57 -0500 Date: Wed, 10 Jan 2024 11:18:57 -0500 From: Bruce Momjian To: "David G. Johnston" Cc: Torsten =?utf-8?Q?F=C3=B6rtsch?= , PostgreSQL mailing lists Subject: Re: slightly unexpected result Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jan 10, 2024 at 09:06:31AM -0700, David G. Johnston wrote: > It is mostly documented. > > https://www.postgresql.org/docs/current/queries-with.html# > QUERIES-WITH-MODIFYING > """ > Only one of the modifications takes place, but it is not easy (and sometimes > not possible) to reliably predict which one. > ... > In particular avoid writing WITH sub-statements that could affect the same rows > changed by the main statement or a sibling sub-statement. The effects of such a > statement will not be predictable. > """ > > Yes, an error would be nice, but the effort put forth stops at unpredictable, > and saying just don't do it. Oh, good to know. :-) -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you.