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 1q5reK-00046B-Ap for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Jun 2023 17:36:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q5reJ-0005E8-3U for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Jun 2023 17:36:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q5reI-0005Dz-QL for pgsql-hackers@lists.postgresql.org; Sun, 04 Jun 2023 17:36:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q5reF-000DEs-UC for pgsql-hackers@lists.postgresql.org; Sun, 04 Jun 2023 17:36:14 +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 354Ha8P63977002; Sun, 4 Jun 2023 13:36:08 -0400 From: Tom Lane To: "Imseih (AWS), Sami" cc: PostgreSQL Hackers Subject: Re: [BUG] pg_dump does not properly deal with BEGIN ATOMIC function In-reply-to: <0AA8F2B1-7855-4F25-BD6C-83CB85722120@amazon.com> References: <2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com> <49272.1685708176@sss.pgh.pa.us> <0AA8F2B1-7855-4F25-BD6C-83CB85722120@amazon.com> Comments: In-reply-to "Imseih (AWS), Sami" message dated "Fri, 02 Jun 2023 21:26:50 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3977000.1685900168.1@sss.pgh.pa.us> Date: Sun, 04 Jun 2023 13:36:08 -0400 Message-ID: <3977001.1685900168@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Imseih (AWS), Sami" writes: > Some minor comments I have: > 1/ > + agginfo[i].aggfn.postponed_def = false; /* might get set during sort */ > This is probably not needed as it seems that we can only > get into this situation when function dependencies are tracked. That's just to keep from leaving an undefined field in the DumpableObject struct. You are very likely right that nothing would examine that field today, but that seems like a poor excuse for not initializing it. > 2/ > The following description makes more sense. > + * section. This is sufficient to handle cases where a function depends on > + * some constraints, as can happen if a BEGIN ATOMIC function > + * references a constraint directly. I did not think this was an improvement. For one thing, I doubt that BEGIN ATOMIC is essential to cause the problem. I didn't prove the point by making a test case, but a "RETURN expression" function could probably trip over it too by putting a sub-SELECT with GROUP BY into the expression. Also, your wording promises more about what cases we can handle than I think is justified. > 3/ > The docs in https://www.postgresql.org/docs/current/ddl-depend.html > should be updated. Right. In general, I thought that the new-style-SQL-functions patch was very slipshod about updating the docs, and omitted touching many places where it would be appropriate to mention the new style, or even flat-out replace examples with new syntax. I did something about this particular point, but perhaps someone would like to look around and work on that topic? regards, tom lane