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 1weVWn-004q8F-0I for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jun 2026 10:17:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1weVWl-007ZVs-2i for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jun 2026 10:17:15 +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 1weVWl-007ZVj-1O for pgsql-hackers@lists.postgresql.org; Tue, 30 Jun 2026 10:17:15 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1weVWj-00000000tuC-2cn9 for pgsql-hackers@lists.postgresql.org; Tue, 30 Jun 2026 10:17:14 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-c8deb37737dso1442588a12.1 for ; Tue, 30 Jun 2026 03:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782814632; cv=none; d=google.com; s=arc-20260327; b=G4f5gQxszBzsjuoATsgpIfx4Ne/+WEHflamWqv99IqPr9UbvGpmHE/VuhfawY3Qq/I MCjxXaVVKMHtHsfSHdPoLAvbM9Ca4SnGIoOMLFDoj4dWL4DNjwavfGlyZ+UmhMa57Il0 0fqVmZ0sJ+kllURn3LynsDGI+1ODuR0tXQir7o+bfO69K767DsP4Nz4joGfJFmpruH44 /SaRtFGqG5VHwxwMN+XoUbsibh350Cqrl5pjF8jJ+u+GN+4AABQh0F3WNvS59dBbR76F sNFeY04/sOGduJy570fRNagj4NmBgRdmF++/JQ4FzWEA5jaX6UDeg19ybCj/X5Qk9PTW J+fA== 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=N6coeBaXhvE32Hgdb3gR0ZWCiAd8S1NCiwYApMQWpl0=; fh=2Fa4xtraqetjx3BYFgQwXfFUGkURKS6McO1XP2pGP20=; b=n88a+UHcDQd8/+a90KoD4+QnY/C4wxdoboXPMhlkk4ICBx559+loHyncOi+NDMpdKl eMmoU1n0Dn7u7exEo9Ha2MbtOCGwPGhQmTnfg6zweiiJAMUwRLqL/nLh5mw2areZf7Tj FscxYZVKDZLzKIOQnevxIVd5mqwiNEllmcu9iZ7/k/RyFw6FK69KEn4LuBBt7vaKL9B5 juZqj8Uao3lChX04NJ0w51Msqt5B5eGTmGhaf2QCLBdfymMJ7ooKXyTl3irBt4Am7ifU /imQ2XdIUc3TPJmizBIgoyhzHRZDKsmFotSOV5gwRKUkl1qDlm7RVVhX7RWvwvMVo/1y fjdg==; 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=1782814632; x=1783419432; 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=N6coeBaXhvE32Hgdb3gR0ZWCiAd8S1NCiwYApMQWpl0=; b=UNPjKtgX5Rk84GvBCSQNT+h8yDxqaXIDemOGoU7gpJoEIsn+bc0OEOSqmXx1vaWweq g3M5XWVs97VZK2eewMbz0+Zn+KFBB70DcaZbpH8UfhIee1cW2T94jlwnDkxYiqWNwDV9 Z+Yr2feI5igx6Ym006U+DxFc4XeQIF71vCmtiGEPvHqrtRG5T9E/apbQ1GDwjzBGaOVb hj0v4CJANSo0qCET+oh6j7hVhUUymwVjqgu9E/It561OKcfOSSdekgeSyWYM1486YJ/H gtw1cMePLMC0uWqZOSGPOut1dZWbDVqyoiv0BmHLbQMXtAo4jxV38xMu6NJ+PiNfPQR1 RA6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782814632; x=1783419432; 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=N6coeBaXhvE32Hgdb3gR0ZWCiAd8S1NCiwYApMQWpl0=; b=mmJxvHepQOmbM/SsPT/lGb3cpV4Ip3VOinUu/L5bbr6M4Cf5X0uaQnb7cqeGLS7Ig4 yi0px2CWS2ng1K/ceCW4hTToT/xyeuAKYsrKafswrNEqgfarVQpUWCE9x+HjzGSlaIKO FzkGNsMLgo15tm6NiFbXuQVM1Gv0iqHcCVzYnoaW0+D7TgJZwiUEDq0sm4Ph9KDObnAO Z/tl0E5ecjk4bTRFhctlBXfCMkdIGcPBK9Yed7C6BVHmprBPer6vkb2+Qh60khSJGPsx sOiFLxxCJYhDbURTz6/9Wgd05rYenGc2D50f09/dDySs/bOUjP+T3pkFUgPXBXX9tTIP +scA== X-Forwarded-Encrypted: i=1; AFNElJ93ur8gnqAaPInEl5AIvRguAH9QNNvXNNxJysqEtULNY+XPNtij7rT6lABPgICWICQR6OhG8FLp2rwepvmh@lists.postgresql.org X-Gm-Message-State: AOJu0YwRuvLCSSHWWZBzXk3OFwG/a4dje9ZP5Pa3sI5JNeEn9TTioEct 9eY1o8w4heMUNMpkkGcyiChLs8HIY6wN2TyB6GLW2FBZhZORo0zfZtVBoF0cI75QRRCCKVts74X htwnlSenQ7Zgj4aQJNqh1cNy7uYDCODk= X-Gm-Gg: AfdE7cnT7PZ28nHj5AW9uqyfxkGM8OpCuHGibq3MdaogrH6qsv9lAakweDDahLw5FEx qwcR32tMVtkqX5Qm/wPbVs04SiGrI3kNFb0oAFYVrAx+UGJTV2Hp2Fs5jRE/Rwo2Lf6AJ096eVW 8G0ePip6MOw/SepYmN+rO0HB6II0oXQfQxHExIsIyc9CHO6cL6FxqayV13pLnkJnP8c5MuS8QLW S4JLNX6RrCgQRMXpScgwmME4AYO4L3NoSZdYtsA/ztiZfqCATYOApDILdfjd3raIoR5SJnzvcB7 fD2BVYKDSxnDuqGJBWxq8bOxqqrCXOD+5b7qALVYI5IesTmv+mUA9I2UQM+rDV4zRL97Df1ndTs = X-Received: by 2002:aa7:9314:0:b0:845:d285:3b6e with SMTP id d2e1a72fcca58-8479f2d0901mr2438721b3a.58.1782814632498; Tue, 30 Jun 2026 03:17:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Tue, 30 Jun 2026 15:46:58 +0530 X-Gm-Features: AVVi8Cf4bGQG1WF8Y89xHSulGsQiVVL5OQFKgaTgDE0v_ez00tfJSFr8gkcslCQ Message-ID: Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications To: Nisha Moond Cc: Peter Smith , Amit Kapila , 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 Mon, Jun 22, 2026 at 6:20=E2=80=AFPM Nisha Moond wrote: > > Attached updated patches v16. No changes in 0001 to 0003. > Thanks Nisha. I have resumed review of patch. I have not goen through complete patch yet, but please find a few initial comments: 1) I get this during compilation: pgoutput.c:2232:45: warning: declaration of =E2=80=98except_pubids=E2=80=99= shadows a previous local [-Wshadow=3Dcompatible-local] 2232 | List *except_pubids =3D NIL; | ^~~~~~~~~~~~~ pgoutput.c:2100:29: note: shadowed declaration is here 2100 | List *except_pubids; 2) I am checking the flow: get_rel_sync_entry-->GetTopMostAncestorInPublication @@ -2267,7 +2290,8 @@ get_rel_sync_entry(PGOutputData *data, Relation relat= ion) ancestor =3D GetTopMostAncestorInPublication(pub->oid, ancestors, - &level); + &level, + except_pubids); a) For what all publications, flow will come to above point. I guess it can come for a explict table pub or a schema pub. For a schmea pub, except_pubids make sense but not for a explicit-table pub alone. Please add a comment atop GetTopMostAncestorInPublication call here to explain the scenario adn then the need of except_pubids. b) We have got except_pubids in the begining of the function as: except_pubids =3D GetRelationExcludedPublications(root_relid); Now inside GetTopMostAncestorInPublication(), we are keeping 'except_pubids' as constant while moving through all the ancestors. We are fetching GetRelationIncludedPublications and GetSchemaPublications for each ancestor but are not computing GetRelationExcludedPublications for each ancestor. It may not be obvious (for many new readers) why 'except_pubids' is not fetched again for each ancestor. Please add a comment there (perhaps because EXCEPT list can not have any partition and can have only root) 3) The error message below and its associated validation logic are duplicated in three places: "cannot appear in both the table list and the EXCEPT clause" Do you think we could factor this into a small helper function and reuse it everywhere? That would make the code more modular and simplify future changes to validation or error messages. thanks Shveta