Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oyOsb-0001UI-Mv for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Nov 2022 02:55:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oyOsa-0000l1-JV for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Nov 2022 02:55:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oyOsa-0000ks-5b for pgsql-bugs@lists.postgresql.org; Fri, 25 Nov 2022 02:55:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oyOsX-0007h0-9K for pgsql-bugs@lists.postgresql.org; Fri, 25 Nov 2022 02:55:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2AP2tiSn3976550; Thu, 24 Nov 2022 21:55:44 -0500 From: Tom Lane To: Alvaro Herrera cc: "David G. Johnston" , Roman Garcia , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17696: Creation of deferrable initially deferred constraint breaks before transaction commit In-reply-to: <20221124222356.qolurdwwcnxkbjt2@alvherre.pgsql> References: <20221124222356.qolurdwwcnxkbjt2@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Thu, 24 Nov 2022 23:23:56 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3976548.1669344944.1@sss.pgh.pa.us> Date: Thu, 24 Nov 2022 21:55:44 -0500 Message-ID: <3976549.1669344944@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > On 2022-Nov-24, David G. Johnston wrote: >> I don't see any benefit for the effort making it work for DDL. > Yeah ... I agree that this scenario seems rather pointless, but I don't > see any hard argument for making it not work, other than development > effort. There would need to be a side-eye on whether it breaks pg_dump scripts being run in single-transaction mode. Verifications of deferred fkey constraints would all be delayed till the final COMMIT, which at the very least is not what pg_dump is expecting. I think it'd pose a problem for parallel restores, in which restoration of such constraints could no longer be parallelized. I don't think we have any cases in which a subsequent view creation would actually fail, but I can believe that a subsequent matview-population query would run much more slowly than expected because the fkey relationship couldn't be used yet for plan optimization. On the whole I share David's guess that the cost/benefit ratio of making this happen is unattractive. I might feel impelled to do it anyway if somebody could show that the SQL spec requires it ... but I bet you'll search for that in vain, because I doubt that the SQL spec requires transactional DDL at all. (There are too many influential implementations that would have a problem with that.) regards, tom lane