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 1wZIVU-000vW6-2g for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jun 2026 01:22:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wZIVT-00EIo5-2P for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jun 2026 01:22:23 +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 1wZIVT-00EInw-19 for pgsql-hackers@lists.postgresql.org; Tue, 16 Jun 2026 01:22:23 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wZIVR-00000000chw-0rfv for pgsql-hackers@lists.postgresql.org; Tue, 16 Jun 2026 01:22:23 +0000 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-5177b9a02bdso53804401cf.1 for ; Mon, 15 Jun 2026 18:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781572939; cv=none; d=google.com; s=arc-20240605; b=lhWl8R7/98sMgOQuKqfiNmA86ktOYLetn8kGT5P+t1maI8HuMVdQoRHGloWh4v470n jg3Q4u4KjBJtaISBOB0H6F7wT5uWOhICWPmMdWJxfHpeubJnES6oIjhpaPnOQUggc7A1 D7tZj/sq0Jiavq6geMtnrTa5dKkM5Hj5Th655yKvI7iKSja04gzviPYqwAOnNjZGTisU igybMR1LIuiDX8/S2n5nizOfBlnnOjuuu32HpMjAcpGpL2xMBYq+bwFC+63A7xLuMWQr wh1uSHr5Kjq+e45B64UrLxZ2AH4f04cmt4dGEd86n+PaI/ETmkyaVBsk7gfJrA3K2Jdv GJvQ== 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=M4Rgu62WqknmpkWauQYFOJqxlqPhN3n5sNcNf3Smfiw=; fh=v+qi42O7HNcU9jgFjlk/xD+t/RrVD3XlM3cesA4jMD4=; b=DxDavqQNnhXf+eYZcVL1PxK0SVb0uGnwDFFLEbb3eKSeMIhiLbN35woIejMtLQVDN6 mTY7t3bHblP+2j/7AsrYWE0bvHG+SJj6vsCF/Kv5g6DszLAS2opcGnGMGXmlaX7xrkmk mgIPszqS7qYRABa1weC4QUc0MtYbkV7z93DGPTqMYaWJt0YiELnBOVB42zS6Qtvj+ugE fagfXBwtQbOlZGMLhwCvqSn3WB0BOyXU3qTyv7XqKCgasYiIqZI4LwFDP3HpKUhRGgY6 v9pdJgzj8/S8NGaexU3tas9OCFTBGfZxZo5MlcXEqNb3hHiwXaG2+tU3GrYqQem+5xQx 83Wg==; 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=1781572939; x=1782177739; 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=M4Rgu62WqknmpkWauQYFOJqxlqPhN3n5sNcNf3Smfiw=; b=RdbBVHs5RbQSVxAojyi/SdjsombtIhVee2WWymDepCHuTAY5lXgDi6+2v9p6EYULFE KHqFSd/RbjaW73/MtAPUq9QZI4roFMk9OgDyO5S8futghCFFci2UYV184/gjI2L3fhZ/ uUD9AXGvEf5wvpmDGXJKKf4DeVJ18CeUYfNsg1U63QhtRNxTJoMwchUmrr+SRDn8xm96 iBGDMaHvnZ9A9z94NSwWYWysppdOAARcD0oze+g2PhbgprgJ68PmOv8WRLANQfeOIhJf zkSleu94OSPjJezZHBz0MrtdIp0B0dzaY8hBVxJuyy+M+AAJk8xXT6bnXDp91tNx9nwB Ee8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781572939; x=1782177739; 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=M4Rgu62WqknmpkWauQYFOJqxlqPhN3n5sNcNf3Smfiw=; b=SRTiGpUmhAjih7Zn8oLsjLoTeva2nEPthQVPsi/eGPhHeFUVd5LvX3zH0OJe5a45Z0 CkdoWwq+PMVIHKoyDGjNuVG5WEDmZ/YD81XeB2r7WYtvQFL0PiFtPBKb+yJSt/LhzLno oAgPi1NZdGf4R+vuviIX3hPb/XqYKNfqEUFdlzUAZwrMUxqW/eKpqsr57/0/+o7DAG+Y ygiHnEiYjqMJpfrlWOaoC3JwBKWWgn3Vjn3k9zLCkWHuOHsTRgXsWfbFXCWLcmol9tBQ i1I1UM1iw91RNaZEgw/kVqGU5ZC0Bw8We/xoKZFT+dR6IcJpdbkhg3WJ7y1gZnKhJpa9 9cwA== X-Forwarded-Encrypted: i=1; AFNElJ9nyHDtxbgra3NkDCeqLl1/LfmiEOXSGxSR5eY1dC7GgM4ywF3LPyL4CuVRZY2MrTVLRZ9GKTBCdpYLsaHB@lists.postgresql.org X-Gm-Message-State: AOJu0Yx9J+egwGun1wAuSckvw14UFm8MHki87fHzXB7hHi/9Wk34KI3q 7lX/tPSjatd4aSrxbg2b9+D8/c9znR9ai/641GZaUWflKD3ioyEIXhWrNj5ECvxt/YMVtENgA4w ukFEYwS9NANa4MPTuioAj6uxMRLGX7Q0= X-Gm-Gg: Acq92OEnKtl4p+WFi2dkOC+UCwiqBu6ZJaLBLyC3YaNHMFrrl7rXHdOZSC4DpBAcIdW d64QF4UY9ObSSJFcjPTHqSxSSqrd87IPyvVcb/GvnERTiqqjC9xRnMsljjjZl+m+Ua2nO0c+L7f /L+SwqipUoQrNtWhZmfCxvicKIMdBVGEpe/Ith4u89OiL5S8gz9Opp2qf67nSMmJXSaO8hQoKi9 6Ku8C3XCZ6go4uLrzDZoRP0WsshTjmc1IEBSC+3AiW/BcJX7TWtHbcseNhIR9ufNdx5J0z8sIIJ NECOXno= X-Received: by 2002:a05:622a:143:b0:509:44c3:5fe7 with SMTP id d75a77b69052e-519535e9887mr212458121cf.46.1781572939068; Mon, 15 Jun 2026 18:22:19 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Tue, 16 Jun 2026 11:21:51 +1000 X-Gm-Features: AVVi8Cd1ADdWF2Xq_G0wEEcqqTqtvM83y6DmB0UflWOJknunR2m0JFvg4JMECZU 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" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jun 15, 2026 at 9:31=E2=80=AFPM Nisha Moond wrote: > > On Mon, Jun 15, 2026 at 11:50=E2=80=AFAM Amit Kapila wrote: > > > > On Thu, Jun 11, 2026 at 12:17=E2=80=AFPM Peter Smith wrote: > > > > > > ////////// > > > v12-0002 > > > > > > =3D=3D=3D=3D=3D=3D > > > 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 diffe= rent schema > > > + using ALTER TABLE ... SET SCHEMA, the exclu= sion 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 o= riginal > > > + schema, the exclusion is not restored, and must be re-establis= hed > > > + explicitly using ALTER PUBLICATION. Droppi= ng 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 n= o > > > ambiguity that it might magically come back. > > > > > > YMMV. Leave it as-is if you prefer. > > > > > > > I feel it is okay to keep the proposed sentence to avoid any ambiguity > > by the user to consider the schema-scope state is symmetric. > > > > Okay, I have kept this para as-it-is. > This discussion about the impact of ALTER TABLE ... SET SCHEMA made me wonder what happens for the existing PG19 case of FOR ALL TABLES EXCEPT (TABLE ...) It turns out to be quite different: =3D=3D=3D=3D=3D=3D test_pub=3D# CREATE SCHEMA myschema; CREATE SCHEMA test_pub=3D# CREATE TABLE t1(A INT); CREATE TABLE test_pub=3D# CREATE TABLE t2(A INT); CREATE TABLE test_pub=3D# CREATE TABLE myschema.myt1(A INT); CREATE TABLE test_pub=3D# CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT (TABLE myschema.= myt1); CREATE PUBLICATION test_pub=3D# \d myschema.myt1 Table "myschema.myt1" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- a | integer | | | Excluded from publications: "pub1" test_pub=3D# \dRp+ pub1 Publication pub1 Owner | All tables | All sequences | Inserts | Updates | Deletes | Truncates | Generated columns | Via root | Descri ption ----------+------------+---------------+---------+---------+---------+-----= ------+-------------------+----------+------- ------ postgres | t | f | t | t | t | t | none | f | Except tables: "myschema.myt1" test_pub=3D# ALTER TABLE myschema.myt1 SET SCHEMA public; ALTER TABLE test_pub=3D# \d myt1 Table "public.myt1" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- a | integer | | | Excluded from publications: "pub1" test_pub=3D# \dRp+ pub1 Publication pub1 Owner | All tables | All sequences | Inserts | Updates | Deletes | Truncates | Generated columns | Via root | Descri ption ----------+------------+---------------+---------+---------+---------+-----= ------+-------------------+----------+------- ------ postgres | t | f | t | t | t | t | none | f | Except tables: "public.myt1" =3D=3D=3D=3D=3D=3D This experiment shows that moving the table did *not* remove the exclusion. It is kind of "explainable" in hindsight because the exclusion is by table OID, not name, so it follows the table around when it is moved. I don't think this is what a user would expect, given that they explicitly asked to exclude it from a different schema. Is it a PG19 exclusion bug? Is it behaviour that needs more documenting? ~ IMO it seemed like a bug of the PG19 FOR ALL TABLES EXCEPT, because it is the opposite of what the new FOR TABLES IN SCHEMA EXCEPT patch does: "If a table listed in the EXCEPT clause is later moved to a different schema using ALTER TABLE ... SET SCHEMA, the exclusion is removed;" Thoughts? =3D=3D=3D=3D=3D=3D Kind Regards, Peter Smith. Fujitsu Australia.