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 1oWXI3-0004PK-6b for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Sep 2022 06:14:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oWXI2-0007wk-3I for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Sep 2022 06:14:58 +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 1oWXI1-0007wb-Q9 for pgsql-hackers@lists.postgresql.org; Fri, 09 Sep 2022 06:14:57 +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 1oWXHy-00066u-AX for pgsql-hackers@postgresql.org; Fri, 09 Sep 2022 06:14:55 +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 2896Ephf037272; Fri, 9 Sep 2022 02:14:52 -0400 From: Tom Lane To: Amit Kapila cc: Peter Eisentraut , pgsql-hackers Subject: Re: why can't a table be part of the same publication as its schema In-reply-to: References: <2729c9e2-9aac-8cda-f2f4-34f2bcc18f4e@enterprisedb.com> Comments: In-reply-to Amit Kapila message dated "Fri, 09 Sep 2022 11:28:19 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <37270.1662704091.1@sss.pgh.pa.us> Date: Fri, 09 Sep 2022 02:14:51 -0400 Message-ID: <37271.1662704091@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Amit Kapila writes: > To avoid these confusions, we have disallowed adding a table if its > schema is already part of the publication and vice-versa. Really? Is there logic in ALTER TABLE SET SCHEMA that rejects the command dependent on the contents of the publication tables? If so, are there locks taken in both ALTER TABLE SET SCHEMA and the publication-modifying commands that are sufficient to prevent race conditions in such changes? This position sounds quite untenable from here, even if I found your arguments-in-support convincing, which I don't really. ISTM the rule should be along the lines of "table S.T should be published either if schema S is published or S.T itself is". There's no obvious need to interconnect the two conditions. regards, tom lane