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 1whLmI-000AaR-0l for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jul 2026 06:29:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whLmG-0055GK-2e for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jul 2026 06:29:01 +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 1whLlX-0052k8-1e for pgsql-hackers@lists.postgresql.org; Wed, 08 Jul 2026 06:28:16 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1whLlV-00000000Bbl-2Jdx for pgsql-hackers@lists.postgresql.org; Wed, 08 Jul 2026 06:28:15 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-2cce6a0c9c3so3809235ad.1 for ; Tue, 07 Jul 2026 23:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783492092; cv=none; d=google.com; s=arc-20260327; b=QP+IELqZMp1FXQsi1BzPyGcOqDwjN33gbIOCbsiPGMgJ1D5Qg2kjUTJ/kFRzIfsrnY w5heMewnWM8RVezGqzG7Itho0PyJlCuctWGcV5KWX6ZIwACWR+XYlYVSiV9zqAnZqX3S uDkpsvdsLrgFwbhcFwwxUdhyDWbtoGFZRmQ7SikY40AHGLMGVGSdzbWuRHErBVCUDXLF hg0kSDpAAqff6mxP8+tuB9ydJCK2yEahzhM0kjdRioLYNrifTuaMbGhKNH1zhdzSw+T+ /Uv0lPWj5nKXpJ93+QMktrKGuPniOZMys8DVJv0c1qMPntCUVEZ6jSaikbnUEwjLxB7k F5uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6iQ2NP4jJxcAfvxwRmMydJ921eLmflLTDvKxV8faxWo=; fh=3mm0praMFmmtPWUYI49W8OLJKmD5jHhYFqJBXA4fv2s=; b=eW07gxZBNSnGh7uJiPkrOW4qNnQ3LL1GM9RtONZGSAy9XOaB5zrp/y3yzfETnuAlVz zRwU1rx5LGbgvOUjlkMlUBPRGBEXnygppYNiJQUMum+0581U5dnmVOF4FHgKO8mG+Q5z q68N29IWT3gxg2ygdW259pt4SKABG/Rj6h6IZNaluSGkvO98nPzACgy9Bx29QnvKKy0y PM4e3OZvOUX8QoruNpiDxKwrzSix9d1iVE3yz+/fV3iKAJjL9V4sY8GEjL2PqI/s8M6d uLr+89nQEuKnCfR2YagVunEvOg3bTNM86r2uYj9UiWmDfsFZXdIP50MFpbJDPBiWF4b3 siCw==; 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=1783492092; x=1784096892; 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=6iQ2NP4jJxcAfvxwRmMydJ921eLmflLTDvKxV8faxWo=; b=Sc8nYSWZPqH41dI0+gpIX4o6t4NK+me4zFasStQpIOC1e0zqRDowSkXk3H40yVY94V SUqagjSfTONQUIbohn4DJRG8e+MpyeYb5P1RiKyNBxz6QitHAPHycDiEPxJJEmuAMOs2 YC9z8/p7rTWaP2QJaIhIjf6p5cFetaxEzlbwGJECGHnax1t0cluaJWnN7D9PUIEsHi2A ka7ABbTTin0/qEkBxQ0OL0KI20T+qOtfHqWATMMBbixJI9ouyCFR7wmc4/dK93L+v3kj D+FrvmvCTsx13NTiyINiOEUqfFojz6FjYkUfWTCa5PBAPm5++UEwg0n7xNQ1cfafuIEQ JAYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783492092; x=1784096892; 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=6iQ2NP4jJxcAfvxwRmMydJ921eLmflLTDvKxV8faxWo=; b=TpuDrWFjuqZkYZdnNKzUv0hiRC4Zss303s0BFLU3Adx8uzswcCjNBhYsxk97Yv1GHj xuOidUEVkxvvIZEVdgEVa6Yf2N4p+on2IKdFcVDue7WQd6c8GpRYYuF/GmsmL2hD2aXB 3W4UE/q5lfakCkf2FeRCjWc3UGknx+DwLiE2pJQbbxZ98YO9nnI/oLXWlj7t6wBqWhas 8+QVVlDNbgy0CCn/BtRnhzK32cWmbP6fRVbvdKexJQliS+UCFecWfZ6nkoBAqDuQCASf KjYKjRXjQeTMiC7nL+pLifJAYebCDDBqAbAqPXRDSHJzazWhliqfCihD560XdfIYoCbH 3arA== X-Forwarded-Encrypted: i=1; AHgh+RoMYYBRo2sJ7WLnfUmu0giFe+ohrATgO7mp5qpkT7eOXhwxPvke2EjLwfar6I7vPLBrnP/SDCRi+3laz+rr@lists.postgresql.org X-Gm-Message-State: AOJu0Yy+vGMnYE7vMEHCITpZJSauYSf2zIpE1+YZRpeSPwL+pUubR5dF DzjKt/dtOpOm7Pu6aADv55ZpvgF8wxVrlDhf82LqIu0HPd1KRIMG5lHRqNyejxg8qgFMbROOUSF YuGnFQCq+C55nu3UVkcjeyr/oLHPcx/E= X-Gm-Gg: AfdE7cmRgDKvWqE/x3KSWIhms52coUO1cn13OcGUL1O+WQb/XzI/pVFlskF3Hzd1BQh 1cnVfhacKdqMjoOWmaNw5ae14Eg7XiEZ9xkCro3oBd2g2qbiQhEShaZ7Xwd0/R9dQG8H3aId/48 fihRuvDXdiK6WpqBugnq+lZevV7vcU5X/r5MZX3YASMDvRHugZTiEdDwRX0nAlUObLWfJnZtLDN qXZiYOkLcSwWHi5NqxrFm+Of6dwdjPev1nj1fbr1SyQv7LoMxTeJSfkSzVEvGgWx4m5VtIGGcJr IgZ3L+3KqSbY1A9dPKdvXwV70/QVv1uEzGnGT58jVTjNgCQCqVd46iIVrNdWrOibVIswCVKqd+4 = X-Received: by 2002:a17:903:1b0f:b0:2ca:481:de45 with SMTP id d9443c01a7336-2ccea37370fmr16333285ad.6.1783492091940; Tue, 07 Jul 2026 23:28:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Wed, 8 Jul 2026 11:58:00 +0530 X-Gm-Features: AVVi8Cc9sSoVUjnAycO7H-eTwopPBO-Z6599ExMOZrqj9lMCcuxfPJzYAVuPsLw Message-ID: Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications To: shveta malik Cc: Nisha Moond , Peter Smith , Zsolt Parragi , pgsql-hackers@lists.postgresql.org, shveta malik 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, Jul 7, 2026 at 4:13=E2=80=AFPM shveta malik wrote: > > On Tue, Jul 7, 2026 at 2:31=E2=80=AFPM shveta malik wrote: > > > > On Fri, Jul 3, 2026 at 10:15=E2=80=AFPM Nisha Moond wrote: > > > > > > > > > postgres=3D# alter publication pub2 add table t_part_p1; > > > ERROR: cannot add table "public.t_part_p1" to publication "pub2" > > > DETAIL: Partition ancestor "public.t_part" of table > > > "public.t_part_p1" is currently listed in the EXCEPT clause of the > > > publication. > > > HINT: Change EXCEPT list using ALTER PUBLICATION ... SET TABLES IN > > > SCHEMA ... EXCEPT. > > > ~~~ > > > > Thanks. Do you think we should restrict this case too? To me, this > > seems like another variation of the above where conflicting entries > > are given at the time of sub-creation itself. The root is excluded but > > parittion is included . > > > > postgres=3D# create publication pub1 for table s2.tab_part_1, tables in > > schema s2 except (table tab_root); > > CREATE PUBLICATION > > postgres=3D# \dRp+ > > Publication pub1 > > Owner | All tables | All sequences | Inserts | Updates | Deletes | > > Truncates | Generated columns | Via root | Description > > --------+------------+---------------+---------+---------+---------+---= --------+-------------------+----------+------------- > > shveta | f | f | t | t | t | t > > | none | f | > > Tables: > > "s2.tab_part_1" > > Tables from schemas: > > "s2" > > Except tables: > > "s2.tab_root" > > > > Since alter is blocked for above case while create-sub is not, > If a combination is not supported in ALTER, we should disallow the same in CREATE as well. So, +1 to restrict the case you reported. > I had a > look at the new check added in check_publication_add_relation > > a) The check introduced in this function for partitions/ancestors is > sufficient for cases where an except-list is already present, but not > for cases where we are in the process of adding one. Thus the > create-sub scenario above is not covered by this. > > b) Also the new check in check_publication_add_relation() gets and > traverses complete list of ancestors > > + List *ancestors =3D get_partition_ancestors(relid); > + > + foreach_oid(ancestor, ancestors) > > Isn't getting root (llast_oid(ancestors)) and checking that alone in > EXCEPT list will suffice? Or am I missing something? > I think this should be possible because we allow only root tables in the EXCEPT list. If so, and we are planning to change as per your suggestion then we should add a comment as to why checking only last is okay here. --=20 With Regards, Amit Kapila.