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 1wi9YM-0002aD-2T for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jul 2026 11:37:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wi9YL-00HY3n-0q for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jul 2026 11:37:58 +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 1wi9YK-00HY3d-32 for pgsql-hackers@lists.postgresql.org; Fri, 10 Jul 2026 11:37:57 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wi9YI-00000000e1g-3nXS for pgsql-hackers@lists.postgresql.org; Fri, 10 Jul 2026 11:37:57 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-39c82d9f801so7080421fa.2 for ; Fri, 10 Jul 2026 04:37:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783683474; cv=none; d=google.com; s=arc-20260327; b=Kp0ji7vBdiQudSFhef0yY/ahLcLGuUj651GZusFvFEj7RdYSBNoIZJ8WAOlT9armoC RT0jWo427KwZhc+6CPeCvUzo2lFISXSztOW7oLwdDqgaqY9FXLrz2vzDiQNDg0PtEDlK nHbbDM7Kgg5SDfcO+8PhSdJg3qd+CmxJzOjE32Q5dxAWi/U9ZYqcVvKN/FUAezR3j8hr sP0/Rzn+klT639leOXLPXpsIIjvjQZloCa9uy62cF68Jy6zMvogn5KmGHBJDyXxq+NzI /7lAdxoskysmVysneV0ICHNTx20yOJMPxAHsb2LK+XQoyApPyp9vaT35zg9GR/b2phZs 0SSA== 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=wkJc1iz6rlNr9KYcKo9T6Ls4rX/qQ/lUMqh458gD7Hs=; fh=Lii7dfM15h4or/Q8DaPRBn3O81Ub3W3aDQ7TpRlheSQ=; b=DDxrvgBNa6KN/IXJk6KfhCutyFfklsje4B8ENwLyuuZQIPc65I5fIxMLCkjzwKQrMa j8Pwx9q7kCiPEMZ4WYf0A0fljynZnmJ3cgk8Gui+4ojAUBx5Qm2/bcFvsZu1O/UyXWMF G6FuTnp02X1S2p+brn/1LxAGUK055Xf9X+zaJCx7D6uDR7Y/XVkqFyhK3pjVX1q6CvOK Dy3QxtiKKb1tQMxfnbEg686sTtRtHNb7Yb8w1FnyQTjlcxFmi/77317FmoYLqWSm7Qfk pbId4QNPmuzHVyKED15w7cQ5e7n+3qRI9N9Ymw4KI3RZiZ9HWGri6RmrqdL0epOJbJFw ZVmA==; 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=1783683474; x=1784288274; darn=lists.postgresql.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=wkJc1iz6rlNr9KYcKo9T6Ls4rX/qQ/lUMqh458gD7Hs=; b=cvmmQp1IVPiIeN4TMV7lrFVWCdr/cSTbfsD7ENnX+nMG/IbW7i4Fx6Nd5KlvfD+aiw g784RLpL81XiVJ/5G1b5AsQCtFz+CTXVGvYkDtDowAfnbR1uQVfir9DQcNS2Vz0lVuB+ /YznqxUy08ypFY9IXPEblUzkT5GKeyvNan4A/xOiMbS33jS+CVHLl8HNcayTQ8MqPZP9 y651cwscLSs0KxqAvE0eHa8J9t3LrSAfYCLKTCFP4ucYene5vBAuX+vRmj7C1HlV0VqI J1iKwNQf9iwU2ExOqSLDnsrpZZP4AKOctkUnIjveYhUoItDlIOkG7Izld1WnBTTR/SoL WqbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783683474; x=1784288274; h=content-transfer-encoding:content-type: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 :content-type; bh=wkJc1iz6rlNr9KYcKo9T6Ls4rX/qQ/lUMqh458gD7Hs=; b=ZE0kQPidaGUBzi3oJq0zLV3sGLsYG60fAO0wVueChM3sEbRaAVzdP5dcf7szVA4rPc xT/k2QB4seBbryUznaW3Z3di3LHZDFP+2Ye65ilji1ymLmSJtpHlOlf7KpGKlZFPWhIp yZLy0aVhOyh8kwLwPLeygWlkkzXcfzoobTO+ye4Aqn2FKcEZSQf0HVw3x1coaNLgPD6W /NOm+eTWt8vt/0bRAFFHjYnGpG7JafaH5A4MH9D8xxiRKowecv6i1FWEl9cXskPSulmD n8Rqw5Dbcw2IWHsyQl7Xys184v2oN5elFo3TaOTcMJ2wP4QDTiBLwmZnoxj/uFOgh0ru j3Vg== X-Forwarded-Encrypted: i=1; AHgh+RoHMPOSXbziBFv/FdAG7/iS8WKv+J0JyAjqeG2TJt+Wf196CMHhAx40HTEhs+vHXefJdAUIWLJ4jC2pSAQf@lists.postgresql.org X-Gm-Message-State: AOJu0Yw67PLYr9IYGlzYuK2E4uR3fpiwx83IKWl6waJu55MIVhNcLCcJ kK+UA1QXQ3N+CYwhWympphCY1Qw1smh8oANLyEABebCZdg8PZbY+4uKKyJaUaV1Qf6jZApxbgaq kRDN7cQNcuWcvq5cQwnsloWJLNyjUqw== X-Gm-Gg: AfdE7ckba1Upu2NX2iGGdlzGd24Hj4lyG4UdHnn6BcnLTxJ4WfWK3aWEGi77EmlXbNP 6T2SYPD2zUnadEYaxhjtTkNs/TTg8gCyRKOItGsfPyZ5ewIfHksvjsNZctPt7ITngnydP0NDo/Q ZoRxccQW+My+G8n9086/YJ6mPMGNfn7IdlQPuJW2iM52BZk1FCeJoLIKuX8SqVVVK1eSG7SAWj0 Edu0kZBVOk12hBC/IFM5/S3X2CtR7LyZ21dOpIHUmOJ9xybF3bjH5CAxMj8V8vzRaUNUUV0tCpt SF4= X-Received: by 2002:a2e:b010:0:b0:39c:7089:8053 with SMTP id 38308e7fff4ca-39c7997ce40mr19793591fa.29.1783683474234; Fri, 10 Jul 2026 04:37:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nisha Moond Date: Fri, 10 Jul 2026 17:07:40 +0530 X-Gm-Features: AVVi8CdsPeC551TqK0rH8b3vjapm5KlmOv742OgzCO3PtBJgMMScYwFoKe7QtTA Message-ID: Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications To: shveta malik Cc: Peter Smith , 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 Thu, Jul 9, 2026 at 2:53=E2=80=AFPM shveta malik wrote: > > > > > To reduce duplicate code, I moved the schema > > qualification and eligibility checks for both cases to execution time >> and removed the corresponding processing from gram.y. > > > > Since this changes a fair amount of code, I've kept it as a separate > > patch (v19-0002) to make review easier. Depending on the feedback, we > > can optimize the implementation or move parts of it back into gram.y > > before merging it into patch 0001. > > ~~~ > > > > Nisha, > > - * Also flattens except_tables from TABLES IN SCHEMA nodes into the list= so > - * that ObjectsInPublicationToOids() sees them as top-level > EXCEPT_TABLE entries. > + * The except_tables attached to TABLES IN SCHEMA nodes are left in plac= e; > + * ObjectsInPublicationToOids() qualifies names, validates schema member= ship, > + * and flattens them once the schema OID is known. > > Can you please explain what does 'flatten' mean here. > Each TABLES IN SCHEMA ... EXCEPT (...) entry stores its own nested list of EXCEPT tables. Flatten means collecting the PublicationTable from each nested list into a single top-level except_pubtables list, giving it the same structure as a FOR TABLE list that can be passed directly to OpenTableList(). I've reworded the comment. We can also remove it if it seems unnecessary he= re. > The flatten logic here is added by your patch001 only, it is not an > existing logic. To me (in my initial round of review), it seems okay > if we moved it to ObjectsInPublicationToOids(). The only thing is that > the one error (table in EXCEPT clause does not belong to schema) which > is possible to get at the parsing stage will now be emitted during > pub-creation stage. Yes, the logic was introduced in patch 0001 itself. I just highlighted it for the case you mentioned, where the error is deferred instead of being raised at parse time. > But since it will keep the entire logic of > except-list verification at one place and considering that > creat/alter-pub is not so frequent operation, I am fine with it. But > lets see if others have any comment here. > My thought was the same: to keep the logic in one place for now. Let's see if others have any opinions on it as well. > ~~ > > I had a quick look at the changes: > > + * Include the ONLY-ness of this entry in its signature. EXCEPT > + * (TABLE parent) excludes parent and its inheritance children, > + * while EXCEPT (TABLE ONLY parent) excludes only parent itself. > > I think this will unconditionally apply to paritioned tables as well > but for paritioned table, EXCEPT doc says that ONLY and * has no > effect, but here it shows the effect: > > Thsi gives error: > postgres=3D# CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA public EXCEPT > (TABLE ONLY tab_root), TABLES IN SCHEMA public EXCEPT (TABLE > tab_root); > ERROR: 42P17: schema "public" specified with conflicting EXCEPT lists > LOCATION: ProcessSchemaExceptTables, publicationcmds.c:299 > > While this does not: > postgres=3D# CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA public EXCEPT > (TABLE tab_root), TABLES IN SCHEMA public EXCEPT (TABLE tab_root); > CREATE PUBLICATION > > But I also checked column-list errors and found that even if columns > are exact sames, we get error: > > postgres=3D# CREATE PUBLICATION PUB4 FOR TABLE T1(i), T1(i); > ERROR: 42710: conflicting or redundant column lists for table "t1" > LOCATION: OpenTableList, publicationcmds.c:2312 > > While this works: > postgres=3D# CREATE PUBLICATION PUB4 FOR TABLE T1, T1; > CREATE PUBLICATION > > This makes me think that even introducing the smartness of identifying > ONLY in case of inherited tables and distinguishing it from > parititoned tables is not required. We can just change your error > message to 'conflicting or redundant EXCEPT lists for schmea "s1"' and > throw error in all cases where schmea with except list repeats without > actually comparing them. Does this sound reasonable? > Yes, that works for me as we have FOR TABLES example to follow. I've made the changes in v20. -- Thanks, Nisha