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 1nqaeJ-0005gG-IT for pgsql-hackers@arkaria.postgresql.org; Mon, 16 May 2022 13:20:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nqaeH-0002My-3P for pgsql-hackers@arkaria.postgresql.org; Mon, 16 May 2022 13:20:33 +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 1nqaeG-0002Mp-Qy for pgsql-hackers@lists.postgresql.org; Mon, 16 May 2022 13:20:32 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqaeD-0008Ra-Ng for pgsql-hackers@lists.postgresql.org; Mon, 16 May 2022 13:20:32 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 4FDFD5C01AA; Mon, 16 May 2022 09:20:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 16 May 2022 09:20:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1652707227; x=1652793627; bh=IMWPoM27TkpeH4xzPMrxWvopjBmT BLiQZbIseEAE0I8=; b=aGd4g2+JvYugh5cuaT7pX1hfCwxRyo3QdCnUhmX/Z0xK 5mjspJh9ACwgiXq+GJSXU5untP/0StseXgT7OU85JfEyP/5/+CILv7/xfV3I4x8L qOnhCyeHBQFHlWcsySBK3gl+18DGVcz5c9VT+4y3WxRNhCaQm+fzkpaMJZJ0lCjP JmGUvvGT2jKIKhhXRDoZmpJ57Ggb2BPqYhxE8W6J/wGPxEDDaVJ9Ut8wFNGDm5ni HdEFDvEEkaEWrfeq2fGGGP7Z/IdKHMF2+IfjF8GSU+IehpF9WD4chDWZwsNGLep+ qhYRDRWj1MVhgjdhBWb/0npA5bB5Jm3Q1Uepa9Moxw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrheehgdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeejkeff gfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 16 May 2022 09:20:26 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E88C12A0817; Mon, 16 May 2022 15:20:33 +0200 (CEST) Date: Mon, 16 May 2022 15:20:33 +0200 From: Alvaro Herrera To: Amit Kapila Cc: "houzj.fnst@fujitsu.com" , Tomas Vondra , Peter Eisentraut , Pg Hackers Subject: Re: bogus: logical replication rows/cols combinations Message-ID: <202205161320.butjtubabvgj@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-May-16, Amit Kapila wrote: > > Agreed. If we can get columnlist and rowfilter from pg_publication_tables, it > > will be more convenient. And I think users that want to fetch the columnlist > > and rowfilter of table can also benefit from it. > > After the change for this, we will give an error on combining > publications where one of the publications specifies all columns in > the table and the other doesn't provide any columns. We should not > give an error as both mean all columns. But don't we need to behave the same way for both column lists and row filters? I understand that some cases with different row filters for different publications have shown to have weird behavior, so I think it'd make sense to restrict it in the same way. That would allow us to extend the behavior in a sensible way when we develop that, instead of setting in stone now behavior that we regret later. > Few comments: > ================= > 1. > postgres=# select * from pg_publication_tables; > pubname | schemaname | tablename | columnlist | rowfilter > ---------+------------+-----------+------------+----------- > pub1 | public | t1 | | > pub2 | public | t1 | 1 2 | (c3 < 10) > (2 rows) > > I think it is better to display column names for columnlist in the > exposed view similar to attnames in the pg_stats_ext view. I think > that will make it easier for users to understand this information. +1 > I think we should change the "descr" to something like: 'get > information of tables in a publication' +1 > 3. > + > + /* > + * We only throw a warning here so that the subcription can still be > + * created and let user aware that something is going to fail later and > + * they can fix the publications afterwards. > + */ > + if (list_member(tablelist, rv)) > + ereport(WARNING, > + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), > + errmsg("cannot use different column lists for table \"%s.%s\" in > different publications", > + nspname, relname)); > > Can we extend this comment to explain the case where after Alter > Publication, if the user dumps and restores back the subscription, > there is a possibility that "CREATE SUBSCRIPTION" won't work if we > give ERROR here instead of WARNING? Yeah, and not only the comment — I think we need to have more in the warning message itself. How about: ERROR: cannot use different column lists for table "..." in different publications DETAIL: The subscription "..." cannot currently be used for replication. I think this whole affair is a bit sad TBH and I'm sure it'll give us some grief -- similar to replication slots becoming inactive and nobody noticing. A user changing a publication in a way that prevents some replica from working and the warnings are hidden, they could have trouble noticing that the replica is stuck. But I have no better ideas. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/