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.94.2) (envelope-from ) id 1v3FwB-00DXhZ-Cn for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Sep 2025 15:37:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v3Fw8-002J1J-SA for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Sep 2025 15:37:13 +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.94.2) (envelope-from ) id 1v3Fw8-002J1B-Hg for pgsql-hackers@lists.postgresql.org; Mon, 29 Sep 2025 15:37:13 +0000 Received: from mail-yx1-xb130.google.com ([2607:f8b0:4864:20::b130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3Fw7-000jgX-01 for pgsql-hackers@lists.postgresql.org; Mon, 29 Sep 2025 15:37:12 +0000 Received: by mail-yx1-xb130.google.com with SMTP id 956f58d0204a3-6353ff1a78dso3408857d50.0 for ; Mon, 29 Sep 2025 08:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759160229; x=1759765029; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Cz2SkzpGK33SsLiJGSwgTQPidw0Cxa3yliu1ZeqCa04=; b=EO+kEigP5ddoaC0ph4G+Ej4j85XEYfRFYwHuYfXl6HCRaevktGz2p/XgNP+IYydkHU XIl7gsA85LV6xqfG32Oy4kNNT0DcWB265gH9QF71HVaUR70kZoc+gO6yKnOBeZC5bMcb lbWXyEdshz7ScA9CoW13H9GYYZUvBofAkHTKVQi2D6RGL3/PSmEbTLdT8HCev1ST4rPl AWu42iEfDBDVFW4Mpd3L/JjUu1Xt7H/Bu188AOC6cT3JIm/Eh7PhSzFZKdKXtKBWUDBb 3sUQJeYFYT5ykOqnRzCd4uUlp6MOO7y6/0gIIS1sVAA17oC7XURryyDZFIKLWAg2YpEu 09kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759160229; x=1759765029; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Cz2SkzpGK33SsLiJGSwgTQPidw0Cxa3yliu1ZeqCa04=; b=NwyIw3pg9EiSjxYp3/4bwHE8mDbKr8EXOeXsDxm+6kPaAskfN/wsyOlZlQ4RIpROxX OxG6byorMt6SgyCd+XJIocE/6o1C/mpbLqdsjICczvIEhK26e5tqSpWN+JtU7mpxoOnR 2ALuoYDjhMDxCA4VygCqNWH5hs0UhJAmLE46+hDalVcQOW01zvW5sCTThRdvouAQirZl vkh6wPNs98U9efvZw1dCvk342w9qLEbA/iCUTk868b1SC9g+XyLR/twVQ3pmHQVMqq3I GNfZSsFGvfyjJUKtvaLG1THPTUC3hDip1qsCIqoE7ttM5mHgV3f6N92cyDuQzpII+yqG EIzg== X-Forwarded-Encrypted: i=1; AJvYcCUBuBj4815QROJLTdKgNU5eDtQyyb+yhfjqB9rsPaRfgNwJFcOmMn80Hk2R8BshIUH5rng6OC9YSEdmqeX2@lists.postgresql.org X-Gm-Message-State: AOJu0YxdUhKjJK1ttqfwMKG0J+xBtuDO8LWaLfhcI2mTYWSLYl4xvAYv uYnOfUc0Dt9cVnzC/2ocmmrJFP2ynns+F3DnJTwczIfFBmKIzGhtBgXvjxEAnbfsPpdjUjuMIAs qRo4sMkT62jKjxgEBowt+4Xc6Gw1zMiA= X-Gm-Gg: ASbGncv0sdowR9o1B0iwWHA0KllX7FjDusfohAkHSZm4otzRS5F00ZgIQg6wY2JUnbh e1FUksQpMbwvIlg9k0Yl00q7q0eftLHMJA2FQQ+XI1CD8InbQVi4IMxn+36jcO8dRtBJ2XAJrFX S7xoSy4Tl4QWDuBitShaNyC8/ts2Q6mdiANuVW2LAJl7ccwxGiuN3ka6R2Ff3hqzpLtZhm4u4TB WRf9L9d/XCBykcLPB8P+9beL5o+DH6HqWssLqCNFMEuPTUtExUBGSb+eFBcQL4= X-Google-Smtp-Source: AGHT+IHc1mUOjFcgNLqMFTEPOZ433vGKiPD+OsaTcHQl3l1v55AqdLeagHOy8ZS6MsOz9/0VcJvXAA7znwxX4IiXXV8= X-Received: by 2002:a05:690e:2487:b0:636:ca97:d6d4 with SMTP id 956f58d0204a3-636ca97d83bmr16102455d50.20.1759160228535; Mon, 29 Sep 2025 08:37:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: vignesh C Date: Mon, 29 Sep 2025 21:00:14 +0530 X-Gm-Features: AS18NWDcL8aCf5CM1Xv-5FPUdgws_45x91ZCpu_Dgg0v7HYL6IIo8R9uPoEX9-c Message-ID: Subject: Re: Skipping schema changes in publication To: Shlok Kyal Cc: Peter Smith , Amit Kapila , "Zhijie Hou (Fujitsu)" , YeXiu <1518981153@qq.com>, Ian Lawrence Barwick , Bharath Rupireddy , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 27 Sept 2025 at 01:20, Shlok Kyal wrote: > > Thanks for reviewing the patch. > I have addressed the comments and attached the updated version. If all columns are excluded, we do not publish the changes. However, when a table has no columns, the data is still replicated. Should we make this behavior consistent? @@ -1482,6 +1525,13 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, relentry = get_rel_sync_entry(data, relation); + /* + * If all columns of a table are present in column list specified with + * EXCEPT, skip publishing the changes. + */ + if (relentry->all_cols_excluded) + return; Steps to check the above issue: -- pub create table t1(); create table t2(c1 int, c2 int); create publication pub1 FOR table t1; create publication pub2 FOR table t2 except(c1, c2); --sub create table t1(c1 int); create table t2(c1 int, c2 int); create subscription sub1 connection 'dbname=postgres host=localhost port=5432' publication pub1,pub2; --pub postgres=# insert into t1 default values ; INSERT 0 1 postgres=# insert into t2 default values; INSERT 0 1 --sub -- In case of table having no columns, data is replicated postgres=# select * from t1; c1 ---- (1 row) -- In case of table having all columns excluded, data is not replicated postgres=# select * from t2; c1 | c2 ----+---- (0 rows) Thoughts? Regards, Vignesh