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 1oYYBh-0007oG-3c for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Sep 2022 19:36:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oYYBg-0004i3-0G for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Sep 2022 19:36:44 +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 1oYYBf-0004hu-N9 for pgsql-hackers@lists.postgresql.org; Wed, 14 Sep 2022 19:36:43 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYYBd-0001bp-8q for pgsql-hackers@postgresql.org; Wed, 14 Sep 2022 19:36:42 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id B693432009AB; Wed, 14 Sep 2022 15:36:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 14 Sep 2022 15:36:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1663184199; x= 1663270599; bh=KRBu7Vb67RdW5FkDmEpI8GzdymUBRuP1CnmyzS3g3u4=; b=K EBmtAIas8HVFTOn00p/Mm6Qx/KRh+94xcD6CeZdiSHfF4EdvGdXCFIRUuZ+DtMfY JbHyFr/quWqil2F1biuhGPnjAMQX8lOASrbRWnbFbKyasdatvpPFBE542REmlCiO aNezLUlfG73CxcjiBTvzrqAKQe3tcWUuguZr/mwvhi//VRcZQwkgNT1ZP61IRQZo ZiPt0geeGprbGjBRFZ8daPBXHsXTlY3aPzxYk8/1lnbM43ctbgAmYWtpcYcEQGM5 RYh8QHCCBtxltpaZIbT2bbdH7cBfR/2DGfkw7mshpGFhgo3WBJbtKS3k/OzZX0/M gU9ogehNOVFnosvWq1pbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeduiedgudegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgv thgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnh htvghrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepheelffeggedujeet iefhleetuddvieffhfffvdejvdffgeejkeduleduheduieefnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgr uhhtsegvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 14 Sep 2022 15:36:38 -0400 (EDT) Message-ID: Date: Wed, 14 Sep 2022 21:36:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: why can't a table be part of the same publication as its schema Content-Language: en-US To: "houzj.fnst@fujitsu.com" , vignesh C , Amit Kapila Cc: Robert Haas , Tom Lane , pgsql-hackers References: <2729c9e2-9aac-8cda-f2f4-34f2bcc18f4e@enterprisedb.com> <37271.1662704091@sss.pgh.pa.us> From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 14.09.22 07:10, houzj.fnst@fujitsu.com wrote: > After applying the patch, we support adding a table with column list along with > the table's schema[1], and it will directly apply the column list in the > logical replication after applying the patch. > > [1]-- > CREATE PUBLICATION pub FOR TABLE public.test(a), FOR ALL TABLES IN SCHEMA public; > ----- > > If from the point of view of consistency, for column list, we could report an > ERROR because we currently don't allow using different column lists for a > table. Maybe an ERROR like: > > "ERROR: cannot use column for table x when the table's schema is also in the publication" > > But if we want to report an ERROR for column list in above case. We might need > to restrict the ALTER TABLE SET SCHEMA as well because user could move a table > which is published with column list to a schema that is also published in the > publication, so we might need to add some similar check(which is removed in > Vignesh's patch) to tablecmd.c to disallow this case. > > Another option could be just ingore the column list if table's schema is also > part of publication. But it seems slightly inconsistent with the rule that we > disallow using different column list for a table. Ignoring things doesn't seem like a good idea. A solution might be to disallow adding any schemas to a publication if column lists on a table are specified.