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 1wXZCg-003KxI-0Y for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2026 06:47:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXZCf-00EfuF-09 for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2026 06:47:49 +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 1wXZCe-00Efu7-2K for pgsql-hackers@lists.postgresql.org; Thu, 11 Jun 2026 06:47:48 +0000 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wXZCc-00000002Tn0-2qZG for pgsql-hackers@lists.postgresql.org; Thu, 11 Jun 2026 06:47:48 +0000 Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-5176bbb9384so75956511cf.1 for ; Wed, 10 Jun 2026 23:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781160464; cv=none; d=google.com; s=arc-20240605; b=XlEPLI77Odt/jLn6QHXO5cmetxzBckUZPodeHb1ks32gHXZtLDsJPr0kZxKWGNDUMm +jKku5PXqf420pv1I7Mr1FOhR5BsmxKhNJu8WGu5N74LD8rhOrj+fgul1Ab579DC0owl To7MQ+Yu4N9DhcPyykIveh2UTSI46yr4z6KMnwlm2Pq0vbp3O0yhe2G8Y6weRhYTc5Pu GSJnJHqMp9uinCgz9TzHjnNTyHZgXwBOPe/gRzAHQ2YOMHFUmpbSAGW+BKOfUwIOqmBp iEI4QfRzM1M1ATl9AVk/zAL10QDkHVTID5fL+j/ILOjnHeZp6fO7s0It3JpBcajizwL6 7KTQ== 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=0COlj/xPhm6S/5xqhp05EbqDVzcnfndXvxEZh2Zx4Ug=; fh=SBkuyFa5pchWAgkUN2W/TCQid2fy6iDoZ0p4WPUVJKk=; b=TW0GXHcwFcY16pe4i5Fjnqh/Km0ELOYB0/IQKqGmMyAjFP6HZj4a0CggmB4N9T3LTl filZiiYvPRRVvIRRKcWJxc2JgXHxSokNmH2Mo5v4LgkiKqEtmR0k1Xc9+Wnu+ir84Ab9 IikI1pwT/ZCrlBBA8K++T1P82X0L+y1GoS2JVN5ErKppmDIJhh37nniOCQe6PRhK35i9 IRoAQtkbPy2I/U613dKujZmuHLfSnV7JLuoIftuG+9mc3g834RtQurHZK0D5o1U4ekev N0IHUD+YdzBt8y54osjUUcP58TAYOptxuGfJSTvpBF2GQhzCjLHwDNR30OmW3NeSSJcj 5CNQ==; 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=1781160464; x=1781765264; 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=0COlj/xPhm6S/5xqhp05EbqDVzcnfndXvxEZh2Zx4Ug=; b=nSTYNiSzfkfaMdG74HzTIJSaW5nwL6VXBAt8x3ysNy9BHbK+2K9FrkBWPabbeGsORw tuMcuMCcX6Pn7M+KjFexAEaobPfmdgx9I0bG/AtUfcl/hCjYycquK5bdkGRnNtMhIV86 P9pGsrnuZptwuIGlz/bX955Le0+1DC3i1cnxba0R283OhY69wPHQRa27TehoTf7YtXd3 4+JEP3AMMDSZPzNC54eCa8b98wgIRxdfW5k1kyot54hAVYyc42zbZfQrmAf1v+Neii4/ GDnlmw1SeLd4o77IoqubXKF0xw9sknsVfMroMobw82k3BRPGCwVywO/l2qLA0ILhLO9G W4Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781160464; x=1781765264; 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=0COlj/xPhm6S/5xqhp05EbqDVzcnfndXvxEZh2Zx4Ug=; b=BJZjW/SS4MJdS55L/N8fwQcshE38NtEfsBdXNLcwhMTX6iPAt9QsSQqAo3Og5QbBss hn781eNomU6/w8QgkXJvq46jszAcgeBLcDDgkSUZezMqraC8HG5icNboG4NrB/xCOD0u uscBMD9IqyKFMWhpr3dDRYUfH5OUG8jQRUL2yVg0QRcxa4hRSf2KtB16QvuSbEd/lIwb uyjSSQXk1NlFV/k2AxAj47j5Nf6Wmbm1hE+/jIVe9ZzGSWHX+C9NJGQBzgh+rE0keGB7 uqLiGel6H0X8rs7SjOEOcCv1jhHKhWlKfl9NGkyITJ+tdtlROxQJunDBhM7WyWzLQP7H zuug== X-Forwarded-Encrypted: i=1; AFNElJ/EayYJ0F4fgvXEJvdw4eIi/YsfoaZY42cN3Ro7PLw6U53SqonJbr2XR/1ckg/0GSkgcRIR+fWiHyvHvfO+@lists.postgresql.org X-Gm-Message-State: AOJu0Yx7Y2chDvfGvCM+Y44YK+j7FRatBTV/MD9xLgePIHXmvDRn60X/ wQa0e+SF0+Qr2BTtF6bBxdLXWYROCDFxr4jnjvsEK2GUxS6Fom0D3tSj/cW+n9+2ZhZDwFtArDy z3ZMbgERxEFwviC1FtREk2cKQlKWgVi4= X-Gm-Gg: Acq92OHxxvxQx8cDJEGgp1buBCDdxJcIt7dHjy2BI42B+CpiPSRrb2QTGCoNx0DOVvv fXUBMR+/kC/My2rOz8qVqBAofHjbAspWxQUEfFzPO8fY44a9BLRk5Kttg+1lbFlqw0SS3eEdh8n eBO/KN0JKypzW0svuB+jaRR1eF0fFkdejW7AnXf5X887zv3ODXcCz2XE5Fagbgt0HfW2YrvvGEK zhLtaJ1aFiCiAW3SXqyP7ViWRHR0NZjQyg+vh0TBU5K2Zh577GKx8D2Vx9HuBgyYNVdYl4pRHWQ 8ku+vjINJy2wC6l6dg== X-Received: by 2002:ac8:5915:0:b0:517:6d75:a2cf with SMTP id d75a77b69052e-517ee204de9mr24762621cf.43.1781160464450; Wed, 10 Jun 2026 23:47:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Thu, 11 Jun 2026 16:47:17 +1000 X-Gm-Features: AVVi8Cct3LsoxN7x_jYwxQJRwcw2QqLYBNpYOp1s78K3onztuO_c1H8PKHsaoyM Message-ID: Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications To: Nisha Moond Cc: 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 the v12 patches. ////// v12-0001 ====== doc/src/sgml/ref/create_publication.sgml 1. This clause specifies a list of tables to be excluded from the - publication. + publication. It can be used with FOR ALL TABLES or + FOR TABLES IN SCHEMA. + + + For FOR TABLES IN SCHEMA publications, the + EXCEPT clause is schema-scoped: the exclusion applies + only within the schema to which it was attached. For + FOR ALL TABLES publications, the exclusion applies to + the table regardless of the schema it is in. For that 2nd para, I think it ought to avoid words like "attached" when talking about tables because attaching has a special meaning. Also, I don't really understand what the 2nd sentence is trying to say. FOR ALL TABLES exclusions will exclude the *named* tables. Yes, those named tables might be in any schema (by fully-qualifying the name), but that's not the same as saying "regardless of the schema". So, IMO we can throw away that 2nd sentence, and just keep the simplified 1st one. Since what remains is now very short, probably just combine both paragraphs. SUGGESTION This clause specifies a list of tables to be excluded from the publication. It can be used with FOR ALL TABLES or FOR TABLES IN SCHEMA. For FOR TABLES IN SCHEMA, the exclusion applies only to tables in the schema associated with the EXCEPT. ====== src/backend/commands/publicationcmds.c RemovePublicationExceptForRelation: 2. + if (OidIsValid(proid)) + { + ObjectAddressSet(obj, PublicationRelRelationId, proid); + performDeletion(&obj, DROP_CASCADE, 0); + } Variable `obj` can be declared right here; it's the only place using it. ////////// v12-0002 ====== doc/src/sgml/ref/alter_publication.sgml 1. + + 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. + I think the sentence "If the table is subsequently moved back..." is overkill, and does not need to be said. The prior info "the exclusion is removed" already tells me the exclusion is gone, and I think is reasonable to assume "removed" means that it is gone for good, with no ambiguity that it might magically come back. YMMV. Leave it as-is if you prefer. ////////// v12-0003 No comments. ====== Kind Regards, Peter Smith. Fujitsu Australia