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 1wZNPf-000zTb-36 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jun 2026 06:36:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wZNPe-00FfTU-0t for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jun 2026 06:36:42 +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 1wZNPd-00FfTG-2m for pgsql-hackers@lists.postgresql.org; Tue, 16 Jun 2026 06:36:41 +0000 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wZNPc-00000000bN6-1mcF for pgsql-hackers@lists.postgresql.org; Tue, 16 Jun 2026 06:36:41 +0000 Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-5174a3d9598so37927241cf.3 for ; Mon, 15 Jun 2026 23:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781591799; cv=none; d=google.com; s=arc-20240605; b=SNIVxNv8RW4MtFe2z9NZpLQ3H6fRNFxdI7cTWuhZa8KyfCduU4NzKYs0O/wr2r7xEa xS0cdM6ljSTmHg0BovB8CoxgF6Gg9KRDdExBRecGCTUejXgjBlV7oezLOgDrNYDkX+6Q oS16UlIQLbZ7J1YSASaMlTUU8nJRTAsaCSzHJ5YJlornueOAJg/t5tg7c5cSTFwmi960 GwjUJDJXlqZZxrk1RwV0T3M4llM8SyYyFbKGotCKsqJ3Xwugg466K9AtlLmhtxTeWbT9 oznl4M4NQ3vZM6D68yj7wceAXKpx/EpfwbQdVPjm4W1ZsrrA/B3SGKmxpeVDWYdfmcmd fRoA== 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=+MIKKElrz+rJ0Q/tj2GlAcJA97+S03sgdKgC682pP+I=; fh=hRralfzDole+vl1e4L4E4TQd2MEHSci9GgmC2l2CXjk=; b=RWf2yz8OiPV5W74Y9tn9DaB7xjt4DTPfpmC7hl2ZXWh2+0ydplC6g5qBSZZioEo5rh YNu6FyKh5hLXghmHTAXduahzuaoQTFB+BuXxMBRdQ7Zm7/Hlp2CCcoZZ+twlioJutsQv 9IbxW6UZp/tTb7PYPruboMnFdEizByn9HkHbjN6OOoxy75lULJcxciEpes5vVHa4jgkD 6py7s4jRSzHc9tL0TOM4cAqSiRFHzbtUMKrMhNaA0im7vcH1m6zkUlL1PACtl1HnJjFY k5FPx4Z5fuHgZdshSkrtkaBhv45HVEiPhTeWPYMuOXiRAVlvHM7NErZU6dXMlKZtlM68 k9Bw==; 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=1781591799; x=1782196599; 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=+MIKKElrz+rJ0Q/tj2GlAcJA97+S03sgdKgC682pP+I=; b=aNq2GOPDPoOAirYg8Oc9pkdg//1/0X/Tn+U72puSU+bmNlHWtpvvHcw1AM5gHCzc8T 5wfwzs7p1oSvkjQTvYJjWZSZdF6wq+uc7Z+/n2/3TTJ/xkOzj7J0940ynCqs66ibVUfs sVIP9qEe6mu4wW/oBNaQshek3phbJ+RO5jzNuZYjDdih1olA4L0sNju+eZp3urB1ih16 9MdOi9TEtRpQdlwoYWhVC31WKvB1PwDOdAQyRxpE20ZuiX6HS4hb4pIPjGxGB7kPoRa7 YVSo3wA8pV+lFLoDQHMKRsLFVDG+AVdvaCPbW+PtV/Gz8kc3Z5mObCAwOWSn99CMFShB 4NKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781591799; x=1782196599; 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=+MIKKElrz+rJ0Q/tj2GlAcJA97+S03sgdKgC682pP+I=; b=VZm//I3KdUUq7KH5biJ0mx4zhz6FxDUntElpMwIbNVN7AL/bFDMcdqPsKG+NHYGzZ/ p6NfL7T2vo/smtpiRoumnHZicr+/OJLWFjMcqNARhPz398G4hjY4ERZTOyvUK8XzfsBW /YnfrA9LJv1sM+hAeeqi3oVAUEbzUN2PX+UqZkBhz2qiCOatFXgsRSygSf7FF616tNkS D6MpHx5V/H4Bdd3V0G6gJOOSFM2k8G+W4o7iU+ZQPiB87YP3/G9TSQuojqbMOWqz4pIe AUUN+Ve/i+8EKwEItXRUVr/I11DGgEEmHaRBtTywKu4UNXyzaxq0oQ/CeHlSPV7YXVxk nLQg== X-Forwarded-Encrypted: i=1; AFNElJ/f8+bzBfjbv1yxobZ8AfAbdogL1ONYT6O+CNTLPWkPTVIGDDi3QAiKjXS8VbKPZrH1d7R6WtOz548ZLYxi@lists.postgresql.org X-Gm-Message-State: AOJu0YySTp4dZByQDDtpM03hyECdeVjO3/EAEQN17ymq5LUOgoK3vmHt UD04VSa8LHTotO+y7pySCF/m3/ts0x1ZTduP2yeQ3tuOpr100CfR/nzUlrwO0Lwb0wyUt7RY4Gj qP2Srb2/nbd22QQJcDrnJ9eAMSaEgGzw= X-Gm-Gg: Acq92OGP1KtGotomviEtYqGwdTC7TEFjhO2UPwERH8X+pZAFZ3oE1QAP4tgBjS46bG9 c6d/nhItdEpnliryaYXh8uE1w3FX+uvXX99gRU724hO3DoXr3P55WlVxLiS3yKJcnh71Mz4SYKY 1pc31pIZWeIrFX6cdS3teiJgbNOfh+3OwWX58VJqo44ESo1EVhJEl0EjD8H0SdJYpRMdFRvJGGh TE+ft7mR/DeGCkN1I7DsAa7VfBpGPK/toCC89SvG9r8LpveEyNMNxKkEyN2OE+C9uzzFhFt9cPI uAprEWU= X-Received: by 2002:a05:622a:607:b0:516:d699:a99b with SMTP id d75a77b69052e-517fe4eee43mr247605271cf.40.1781591798854; Mon, 15 Jun 2026 23:36:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Tue, 16 Jun 2026 16:36:10 +1000 X-Gm-Features: AVVi8Cc0R4wnRQ-B3pw5YoyOCkzm4yrLgUBAqb6J3JXqrJPncwli1tJunXOIbyI Message-ID: Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications To: Amit Kapila Cc: Nisha Moond , 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 Tue, Jun 16, 2026 at 2:36=E2=80=AFPM Amit Kapila wrote: > > On Tue, Jun 16, 2026 at 6:52=E2=80=AFAM Peter Smith wrote: > > > > 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 mysch= ema.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 exclus= ion. > > > > 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;" > > > > No, I don't think this is a bug for PG19 and the new behaviour for > PG20 is intentional and required because in this case, the EXCEPT > clause is schema-scoped, so once schema is changed, the table should > be removed from the exclusion list. OTOH, in PG19, the exclusion list > follows the table-level exclusion based on its OID as we can see in > the example provided by you. I think we can consider adding a line for > this in docs if you and others feel that such explicit mention can > avoid ambiguity around this. How about something like the following as > a separate para in EXCEPT clause description: Once a table is > excluded, the exclusion applies to that table itself, regardless of > its name or schema. Renaming the table or moving it to another schema > with ALTER TABLE ... SET SCHEMA does not cancel the > exclusion." > OK. The explanatory text LGTM. What's the next step? Should I create a new thread/patch to deal with this? =3D=3D=3D=3D=3D=3D Kind Regards. Peter Smith Fujitsu Australia