Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hW0OY-0001dC-Tt for pgsql-general@arkaria.postgresql.org; Wed, 29 May 2019 15:21:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hW0OX-0001FX-OU for pgsql-general@arkaria.postgresql.org; Wed, 29 May 2019 15:21:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hW0OX-0001FP-Eq for pgsql-general@lists.postgresql.org; Wed, 29 May 2019 15:21:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hW0OU-0006LV-F5 for pgsql-general@lists.postgresql.org; Wed, 29 May 2019 15:21:37 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x4TFLTAG003140; Wed, 29 May 2019 11:21:30 -0400 From: Tom Lane To: Ron cc: pgsql-general@lists.postgresql.org Subject: Re: with and trigger In-reply-to: <3ae9c51b-2552-a7e9-bbc5-f3d385461f74@gmail.com> References: <1559130758966-0.post@n3.nabble.com> <2487.1559136365@sss.pgh.pa.us> <3ae9c51b-2552-a7e9-bbc5-f3d385461f74@gmail.com> Comments: In-reply-to Ron message dated "Wed, 29 May 2019 10:05:36 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2698.1559143289.1@sss.pgh.pa.us> Date: Wed, 29 May 2019 11:21:29 -0400 Message-ID: <2699.1559143289@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ron writes: > On 5/29/19 8:26 AM, Tom Lane wrote: >> This doesn't explicitly talk about triggers, but I think our attitude >> about the case you're discussing is that the results are unspecified. >> If a trigger fired in one WITH arm tries to look at the table(s) >> modified by other WITH arms, it might or might not see those changes. > Are CTEs still optimization fences? > https://www.2ndquadrant.com/en/blog/postgresql-ctes-are-optimization-fences/ Yes, if they contain data-modifying statements ... but that's not relevant to the point at hand, which is that the run-time behavior is not specified. regards, tom lane