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 1wZfTp-001CjY-1F for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 01:54:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wZfTo-003qzY-0f for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 01:54:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wZfTn-003qzN-2W for pgsql-hackers@lists.postgresql.org; Wed, 17 Jun 2026 01:54:11 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wZfTm-00000000jaO-23FS for pgsql-hackers@lists.postgresql.org; Wed, 17 Jun 2026 01:54:10 +0000 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-5177945a279so59368201cf.0 for ; Tue, 16 Jun 2026 18:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781661249; cv=none; d=google.com; s=arc-20240605; b=h4B39VHMNuJlk5h9kmJBO0yTdUKAEPkI+hxHPAD3t0W1VuPv3ombEzrzVc8qUoR/z9 WF2sVKM5bxSqtq43i1+AIDAZzcVObsQqNNdmjlLeY2bjp/URsjLLOPJzYRTVKBi7Vim2 rB0ySted8eEVM6vOgiWuI7GUX8inT1lCeaQOVVpOsOsn06XXMA3Kz2kpcF2DP6+Ib0b4 xIHmWKpxU1vblf08DYfrNeQPoyx2C29nTWEoksHC4aNprC40My+k2JH+pVllpySFifbS vyMLE4xm8pqhU+8l1yQ2M2HKCFKhR7V2qFBz1wMDp1KqSYkp7IwyDqs2hp8loXE7uP1T xvlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=lW5HjW6v2OvNMmAaUEiM49eKG4UwuAn2drxPLok/LwY=; fh=QvA2yJNXN52w7XoeMbmcvYaziNPlRQFawYoDo+JVoJY=; b=iK90qhuZrpfgpqiJlT86X+c1VQtAiQu9b8ztbelYld26GPCIOAB3FmIwyLcd3emfBl LpFKBB7H1qJysZ2hUyV2mYvV3LbffbRoEyHj8FTrFwlcQ4YkGtQK6A53LZn80OtfFZxu pa8ris8HfTqFnaUZEVG38SK/ZacL5rjqWugBuwsDRBQUYO/7IyQErmc9+H0tWavq1sxj jhR1IfXvZNi57EedMJnN34AcNfQAOjbOJgkJDFfbHZW4qTIPiErBoqeGEuMOW62+wbHY XRKqnurJugSPuqQTR6yVAH8ks/q7rClOrkbAK5FX0fvXrR7uFjTO7rIusfu7Xp+/w/eT pNBA==; 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=1781661249; x=1782266049; 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=lW5HjW6v2OvNMmAaUEiM49eKG4UwuAn2drxPLok/LwY=; b=sBNRwkPY9fe6yh2XexclENEACuRnahZvPD6JZQ7nyFsf0I+MtlUzRBsKU0ZQprVClq ck1WPZcm5Hf0CR7qU4a4ng4osOaEXxJCCuJKkXwFvqzX/wr7L0n/wfIZbMXTef6GxAcf CGYjuZ7lZhgPGr+VE6vYxWiDkqFJDF8iAXNuxDxt1Mkpj8ol+DJF7alY/AhlvnZU9oTw GwomsobR1pwwZuj8CCedve5485UzMIFWxXFSIfGuxEKSjdMgi8W5WVI+evbtShyBaClA 8NL8/oTRVfr13BZXFyeGZ6UO6FAA2buwDFEbW8JiLia+nCDaMLvt2b7Ha3xYUfwpg/Yn RLbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781661249; x=1782266049; h=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=lW5HjW6v2OvNMmAaUEiM49eKG4UwuAn2drxPLok/LwY=; b=EJZHOB/g8/KapENn/KGyNKANxEwiVKJBt0ThzKMVqDWqaVbr+Q240L/aIBBkxkqSB/ HJtOMsSFSPp7MN8Rw6dRjrHF3ilcRYLPiw2vlF2Mk1XSYcKAf0GoUZkul6FkIRRtRCxx dO3svUpba5HmMagxUhYbUgf9nWdZRTDPGY7jMtcxCS+quwiAFDryVQ/5Dczg+gQjug3H /MdBIhZKRneowwFrBv4rnsDK0OtbfNgVUa2FDocl/Cncpxf+8CMUjykYpiaxBdbY5NIx dKPpBRz9nA0oyXxqfh6XOLEsteEruoZlcoeluI7fAT8jy0IAEd/WcmbRKqm9leaILeld D/mA== X-Forwarded-Encrypted: i=1; AFNElJ92X9bzdGerbaiL1xCfUglhZQ7m5/QxyJa63beMZkcouocwp9UA04ObiLK5JXxpOElhhRyK9eKzMrbF1vCB@lists.postgresql.org X-Gm-Message-State: AOJu0YxcEF9LipzUH/3Cmcqmjfa9tgRR/6IZlZaifiKX8x3hWDgNWeij SKlAuzYVmVRMCx/vvvPHcLGpanWcxd0xVyB8O14NSS0NjX3X1ETN8jbv6dCCk6lia9ooADvxojY lNFDjE81HJtenjTZNlnJbGJIjgSWLTWs= X-Gm-Gg: Acq92OG8iBkZBzkPOsbDhwjWfhTydKUJJkH+XgmqnkWV65tMjQ0CwWp0YEW3j6UMa4Z SPBJr3jBdF3Gdu/iE5huKu4EI6Dlt2XjlhJHc1yS3clPE24f+CP3gjrfTRS2SJF3YCj/XbV2bF8 AyQ6w5nFq3KAmWyi4eiP7uSmJzG9LpZwBw/bpa5Q/ZuB+op2Y6DGPnqtm13gfmPtChTSqCclAwc uTYvye/l5qDC21gu6o9U6As6jSE7aX2Z3mokT6uCciOpgthV1yduKqTns4FlyrwklscipkS X-Received: by 2002:ac8:59c3:0:b0:517:8d24:6500 with SMTP id d75a77b69052e-519a8f912f4mr32743861cf.32.1781661248844; Tue, 16 Jun 2026 18:54:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Wed, 17 Jun 2026 11:53:40 +1000 X-Gm-Features: AVVi8CcQHoTSwGn8V3dHoTBMOX37PKA7tmvqcRDhbDjzNu1-AmwHralG1ZwGyk4 Message-ID: Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications To: Nisha Moond Cc: Amit Kapila , Zsolt Parragi , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Nisha. Some review comments for v14-0001. ====== src/test/regress/sql/publication.sql 1. +-- ALTER TABLE ... SET SCHEMA on a table excluded by a schema publication: +-- the schema-scoped exclusion is no longer meaningful once the table moves +-- out of its schema, so the exclution is auto-dropped. 1a. typo: /exclution/exclusion/ ~ 1b. Exclusions cannot be "dropped" (at least, not by a user with the DROP command). So even though this is correct for what is happening internally, maybe from the user PoV it is better to say something like "auto-removed" or just "removed". (Same comment may also apply to the DEBUG logging when this happened). ~~~ 2. +-- Restore so the existing cleanup below still works +ALTER TABLE public.testpub_tbl_s2 SET SCHEMA pub_test; +DROP PUBLICATION testpub_schema_except_setsch; Why not just fix the cleanup code? It's not "existing cleanup" anyway -- it's part of this same patch. //////////////////// Some review comments for v14-0004. ====== doc/src/sgml/ref/alter_publication.sgml: 1. used with a publication defined with FOR TABLE or FOR TABLES IN SCHEMA, replaces the list of tables/schemas in the publication with the specified list; the existing tables or schemas - that were present in the publication will be removed. + that were present in the publication will be removed. When + SET TABLES IN SCHEMA is used with an + EXCEPT clause, the excluded tables for each schema are + replaced with the specified list; if EXCEPT is omitted + for a schema, any existing exclusions for that schema are cleared. "are cleared" or "are removed"... not sure what is better. Maybe "cleared" is fine. ~~~ 2. + + The EXCEPT clause can be used with + ADD TABLES IN SCHEMA to exclude specific tables from a + schema-level publication. + + This is talking about the 'ADD' variant. So really, it belongs as part of that 2nd para: "The first two variants modify..." because that is where ADD is discussed. ~~~ 3. + + EXCEPT + + + When used with ADD TABLES IN SCHEMA + or SET TABLES IN SCHEMA, specifies + tables to be excluded from the publication. Each named + table must belong to the schema specified in the same + TABLES IN SCHEMA clause. Table names may be + schema-qualified or unqualified; unqualified names are implicitly + qualified with the schema named in the same clause. See + for further details on the + semantics of EXCEPT. + + + For FOR TABLES IN SCHEMA publications, the + EXCEPT clause is schema-scoped. If a table listed in + the EXCEPT clause is later moved to a different schema + using ALTER TABLE ... SET SCHEMA, the exclusion is + removed; the table will then be published if its new schema is part of a + publication. If the table is subsequently moved back to the original + schema, the exclusion is not restored, and must be re-established + explicitly using ALTER PUBLICATION. Dropping a table + always removes it from the EXCEPT clause, regardless of + publication type. + + + 3a. TBH, I lost track of what the final decision was about keeping this EXCEPT part. IIUC, you wanted to defer a decision until later, but I did not understand the plan: a) Should the EXCEPT part be present for now, but consider removing it later? b) Should the EXCEPT part be absent for now, but consider adding it later? I prefer what you have done, but either way, we need to ensure Shlok's thread uses the same approach. ~ 3b. I think that last "Dropping a table..." sentence should be a separate , unrelated to renaming/moving tables. Also, you don't need to say "regardless of publication type" -- that would be the assumption unless you say otherwise. ====== Kind Regards, Peter Smith. Fujitsu Australia