Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7Uck-005N91-2g for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 08:38:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7Ucj-008qt7-0o for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 08:38:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7Uci-008qsz-31 for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 08:38:57 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7Ucg-000000028jw-3P3L for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 08:38:57 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5a0fc5e2c59so6188067e87.1 for ; Tue, 31 Mar 2026 01:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774946334; cv=none; d=google.com; s=arc-20240605; b=e5QdoN0mSIa6MFROjWugR8XDj9qOfXOOBlhEiwIuGjKZMCdTslyECfwoZgQMXSZplw bWdLW8eC990Tn6n+U+A1QCTlsFVqKurDjSvNTumnmm+7We96BvGuegTPHkKMVuUz6wzM phlmpvHEsq9JsMugZIOkOhcntk4+M6kZ4lQnWjoHtitwlu6mH8VBOzrXCx8LT7oV8ggG FHY5ma4CaYb6KeEeFVjZF7MVOQJqgYi97qEIe6bAEW/n5R9UlH97qrb6G00YIPyvvaGH 2s03nSCzdQsQ9WBFcyGXvJykVCEwQOoJmuaelPYIl9DxqMRnjNQ8z0o/ZmkoTBa+aibE lEyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wyXFQuqDlb1eo8oXcdRnjAI1V0L0yOk6liVJ3XJKQRE=; fh=rWCXmR9J6ImvDo5VgXliOu3ceL4TR2eLVRLFPa/0S3w=; b=AkcZGPpbVHR98u3WFokY5L/Tuw+KVIsOXYUj2nx5tvOT+Jfp1UU47rEor/EbfjjBAE ZVE90VT0NUWdLRTPZ3nxASwlCOQTEkqcVNnJO9GdPlcw7Wdl/wf3h1/qLZJLKyrBvCTs AUXQn2Md8O+d9DhGQHPyrZlU2hrx4Yjv+k46sMyBdej4rhDubX0xOzKm0Zphstjj16U7 kX7N5eUE3z0wutsCr380HTHtQ78cRT1qDU/c86FfK+yerOm90nG3wbvOVvc5ST/9waEc 5yCpWyEDlKk6dFOmWttFtq5NU3CvbnKlJM94TzlnkRoa/Zwiph3M/jnu3QguhW2C3v0y tnKQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774946334; x=1775551134; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wyXFQuqDlb1eo8oXcdRnjAI1V0L0yOk6liVJ3XJKQRE=; b=jFKrJVCIfAdh0YI6MHsuAX4VaP4/Nr/mnuxCqtRCFrhR+6UBaZbZhlxH4hfVolMNLq npahsbOtLfkO0+pjFpfHG6YmyFGAYH15+0LToMpCgIsCKU8tO8xp/7N1RRWoanbqQn5q Fh+vkh9//aiqC+yoDKT2awBp32Ttl2Ih6+Ajm1iXmXrPw/KznRy/LMZHBW/56jGJJu+W eRM3IXLkN7+CK4TKpMCsGdVsVF1O58rWeSPNFmp0SQSikADUFhXtluVq2/LSh/dL2iSk MIoVql5k57GCDmT3616QiLB3Yxk5Rksoq4c6jOzx/kPy4l6JF7b3uQxJ9lzMy6bwI6v/ rBLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774946334; x=1775551134; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wyXFQuqDlb1eo8oXcdRnjAI1V0L0yOk6liVJ3XJKQRE=; b=LrpWiF8N/0qOvxVGwaf84zzVxRINN7hhnKNVmSsVAiuTOeGAb9LjM4xq3NF/gyGUUG B5hYotK2NgY0kqfxkl2qBJGQL1679hFLybo+Ku8Q24gfNFVi3IwcxhqeH0KlXBAhuPd2 GTVIupYZe5VmvsVuueIiQeCREPXT5yAX2eFwqet5Jcm0LY3BOa3KIhhSAmjDLwvcbC6d W9wrRK2VvzP02zf4el9p7KXp5k34bt7MoEG60Ie4jEPmf5RoqGOeGHBJGRWxRSIbDYnK KBu1Mo4ph5JYMTQb5PSwzlcGVv96P9n+JkVXAYSufZtXBqMbbdUAixeSjRE7pinwrPOD 4zcw== X-Gm-Message-State: AOJu0YwW0ATf6l0Dbpbtz2RXyRp8FovZHBE9SYIDDHcfddx/6cawFIFk zmNemCznGDjpmR1735krhz/pCG6M/nsL1hbJjaLoDYTPe9d1vkEYvu8Mrq9889wE1SGITbxjOpK /FJTMlbm0P108dXgl8KGPDYNFimF4M+Ycnlf6JbQOJA== X-Gm-Gg: ATEYQzwNs8Oae4yJlUD/zpX4KQ4VZQOyphA2B88MT4w7Yt/3PsunN9fuGwAPeZ6q3Wm etlxPHv62VTAfQnRqRY5IWVpjmXRI6KGWycZyhoGI6qvpRXu7tJWefDsI2XLdj4pg/TbmxtT0BX II8nht2WT7Nwd09lWEM2JaA5UqWb50hdMAH/voagMctz6idRx8JJ2PEwk7O1LJi7eP7iNFEBa1D hR0TjXN4LTcLr7hPBKYfbrIAQOQ59S0t0EfTR+7moXrupeGTsh07ejcE9eOowRC68qeC+tJI+fu 11TbOnt7AKVpuzTnyOpAYbMpymL3F8vJgf8gsuQB X-Received: by 2002:a05:6512:3a8e:b0:5a2:9bef:52bf with SMTP id 2adb3069b0e04-5a2ab5fddbemr5833811e87.2.1774946333352; Tue, 31 Mar 2026 01:38:53 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Tue, 31 Mar 2026 14:08:41 +0530 X-Gm-Features: AQROBzCdVZzANwhCczOumFaxPV_RTUDPbo6Qbq_hJ4FYDPqkRilLF8NXJDHIF5s Message-ID: Subject: Re: pg_publication_tables: return NULL attnames when no column list is specified To: Roberto Mello Cc: PostgreSQL Developers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Mar 31, 2026 at 12:02=E2=80=AFAM Roberto Mello wrote: > > The conflict exists because the two publications have different contracts= about future > schema changes, and the subscriber has no way to honor both simultaneousl= y. > > For example: > > CREATE TABLE t (id int, name text); > CREATE PUBLICATION pub_a FOR TABLE t; -- no column list > CREATE PUBLICATION pub_b FOR TABLE t (id, name); -- explicit list > CREATE SUBSCRIPTION sub CONNECTION '...' PUBLICATION pub_a, pub_b; > > At this point both publications replicate the same columns. But after: > > ALTER TABLE t ADD COLUMN email text; > > pub_a now replicates {id, name, email} (automatically, because no column = list > means all current and future columns), while pub_b still replicates {id, = name} > (the explicit list hasn't been altered). > > The subscriber receives WAL from both publications for the same table. > Which column set should it apply? It cannot apply both as they disagree o= n > whether email is included. This is exactly the situation the "cannot use > different column lists" check was designed to prevent. > I think we need to consider the cases where current permissive behavior helps. For example, consider the cases where the schema is static. Now let us consider another case where a user would actually need to define such publication combinations for a subscription. One of the more common ways this conflict happens is accidental: User has pub_1 for TABLE t (col1, col2). User later decides to replicate the entire database to a new subscription and creates pub_2 FOR ALL TABLES. User adds pub_2 to the subscription. Currently, the user can add pub_2 and then later realize they need to drop pub_1 to clean things up. If ALTER SUBSCRIPTION blocks this, the user is stuck in a Catch-22 where they can't add the "All Tables" publication because a single specific table has a column list. They would have to drop the specific publication first, potentially losing replication coverage for that table during the gap. Now, considering the other cases where replication later ERRORs out (like the one you mentioned) when we allow such combinations, we can give a WARNING at the time subscriber DDLs when they lead to such combinations. > The current code suppresses this error by making the two cases look > identical at query time. But the underlying catalog still stored NULL > for pub_a and {1,2} for pub_b, and the actual replication behavior at WAL > decode time (in pgoutput.c) still treated them differently. So the confli= ct was real > but hidden from the check that was supposed to detect it. > > To put it another way: the check's purpose is to ensure a single consiste= nt > column set for each table across all publications on a subscription. Two > publications that will diverge on the next ALTER TABLE ADD COLUMN > do not provide that guarantee. Surfacing the conflict at subscription > creation / refresh time - before the schema change happens - is better th= an > discovering it after, when the subscriber receives incompatible column se= ts > and replication breaks. > > For users who currently have this configuration, the fix is straightforwa= rd: > either drop the explicit column list from pub_b (so both mean "all column= s"), > or keep the explicit list and use a separate subscription. > Or alter the subscription to drop the publication which in your case would be pub_b. -- With Regards, Amit Kapila.