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 1wSYuZ-003GDz-1h for pgsql-hackers@arkaria.postgresql.org; Thu, 28 May 2026 11:28:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wSYuX-00BiEg-1O for pgsql-hackers@arkaria.postgresql.org; Thu, 28 May 2026 11:28:26 +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 1wSYuX-00BiEY-08 for pgsql-hackers@lists.postgresql.org; Thu, 28 May 2026 11:28:26 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wSYuW-000000019qH-1f39 for pgsql-hackers@lists.postgresql.org; Thu, 28 May 2026 11:28:25 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-39393ec4ed0so112401801fa.0 for ; Thu, 28 May 2026 04:28:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779967703; cv=none; d=google.com; s=arc-20240605; b=flo9eCyAGQVey2CznpAEBlDdWjwPJMnq+8JRQsCnok41wF7OCmCNwGcaHUBLBkB2fO nGilv5eHmbD7tcjdB9rp+tlXtpUI4KWCUGEE7T3ElJI2CnBQrKbATrxSBugDlvXFd903 WK229fXjnL/3v2lLZX40gKzMs4fPTIGUAvkYAxHjwLG6ADMON4L/fIp6bEywlp+wWUhC PytY5debGo4elJLfNPt6lrCUyys+R5L7sQGhe3wMVqLKjwwsfz5BCA8mqpoh+SKlu3Jh Oyjzdf7KsRcDOsrpL8tjXu7Dj4OTdKT1QLw4n639q6vn+4WnsZ0/qexsnQ3bNNb5d3Nb PXJA== 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=KBlvKd6hN7b2Turg/dK6CgSzlbon8MNDMAqNqWYFIrs=; fh=dOQpgaU3fYiug3rJ+NbDUu+FPrgowCpgWwtg8ALA7K0=; b=TL4n1h3rPubEiRR3gSI6hTsALQrwDcdumM7TaBJenSDfrtXXLfJ8pmKb+u6wIqtbH6 7mvErJd5Wbrfr7vN2SgSHCFeOVFjtODZ8JGvDpXJCBdriR9e5l8ZrxzVTKBiDy82nJQy F5C8sbDD1cNHRbNYDqXXnWupAPCVIXoV0HKkqa768+39h6sj0vD+obQDVKQqFRB2JBg9 BN41dCQahHvBnHtMEF6Pjf5rZpyyXcsmH3fNxBgaWa6lDog0df1VWGUyrAw10cfrxUzL uARUQjFNYBYYaDOE/zgZ8D1wf0DN5tVeRXlv7IfUvpns4hzeIUTZ1AWU4mlsS2V+JBDp qSAA==; 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=1779967703; x=1780572503; 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=KBlvKd6hN7b2Turg/dK6CgSzlbon8MNDMAqNqWYFIrs=; b=lQUiTNiT0iqBypi4YNWIKEogiUSnUc+VRe2WBnVOL2VJdUJYifkEKdiImJLQzlnCMM UIyjky6EQpph5CRnnwx6DSQyZqXqqn9ERis15eB63JS6ylCuerApnQ63jKrWSQxM6g97 hm+n7q04BkKx/N6ZYU4pxVZRrXzfic4xeGqsoQw81DHi2OCq9jr9WS+4OWYz7jHxAp/9 5sXjdfegQDIjC9uY5HthNUnxaLhx9xfsdz2PIkbVwONVYPvkvglJeLCAji8z+7Cwvujt oGYlZzzEmgjnYRRd98rGjRNJkEJYWhCU0uzbrWTLmr1ByKoS6fMRNiBOWO79Kq2tsE6+ oLgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779967703; x=1780572503; 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=KBlvKd6hN7b2Turg/dK6CgSzlbon8MNDMAqNqWYFIrs=; b=DR5NUboq4Wz6bhhzqm9t5yxvyExL785WtdugbaoB/1feuRVEiYHVqdSTDcawTocAba 9Gcm/5vyCPzroa+7XNzaOuP8NObk9u7z7u/YtsBSoftuZooknq6kTnFdpjkFtP1dhMaL O70wgWDhvV1q7Iyb0ewNtZPeSdO9oTjdWqQzQVW+NPjdv5X3btRutvjPprL2yBCjrMb+ qkBxozW7qzrlvrauxzwqqUvOP4jA3wOTyRPoLEpY8kxpn/fJQoST8wY40Vx+dVAv4z/0 HdWcRzZ7no6NhokASKMLdGYEZns/EWLO0oNxjIXNd44k51gp238TY6rVgSS25T+HI2eR SXEw== X-Forwarded-Encrypted: i=1; AFNElJ8OIRy6cxIgBbCd6KxSAjnfojEQS5DdyxlgdGFutuaZi30WlDNybspIFIt429haMvM/UjZnl4yCUA4ziL4r@lists.postgresql.org X-Gm-Message-State: AOJu0YwdRi7zUhUpkBYrGe4vH2vtVz2ESNmD/xzDnk7tFuRXkGpC5txY PApy0KaIss21iW9OOCj/GbOiXDW/9/BFVXM6NSxeKBXrxSS280DojpVYkcLO7DAgmuF4F+yGVah 5JLS0aziPyl+obWcAVqLay8dagAoFeg== X-Gm-Gg: Acq92OGn94y6P+h8b3qMY/e11RXteSYCRzVZz7VPAGpFNEFIIgFVGtK+XjWnYADgcqE OZpDsZAeYl8G4r0hPZPDKPacOy4BVER0SDhffWUX5XgMClqmt5W39OmBjvnDqKlLmfuH0+VPRPp rjFpxguijtggjQk5hJCNRJce01O2upe0pJqj+EoHvP7bvpO16cOlHJWemCJ4hOER8pEsS04IBqu Z0i7cBSUs6QOtvCf0zsyV4w9cGT9gMmelJmzxsjfeB5Ugk2fxZFw0TlhKvwtQITT9kyKnUUvI3t JFNdJa8QWsYDc+d0F0k3QzO/5R8lJz9erpZH4qdHRp1vCFDc3Q== X-Received: by 2002:a2e:a907:0:b0:38b:be3e:b752 with SMTP id 38308e7fff4ca-395d89c71ddmr80517791fa.20.1779967702567; Thu, 28 May 2026 04:28:22 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nisha Moond Date: Thu, 28 May 2026 16:58:10 +0530 X-Gm-Features: AVHnY4Ja6Je22CEf-rCymu94pPQuKZ7Fh0ddBjR-9qmOk-1w4XqQgAw5K_xdPZM Message-ID: Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications To: Peter Smith Cc: shveta malik , Amit Kapila , PostgreSQL Hackers 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 Fri, May 22, 2026 at 11:00=E2=80=AFAM Peter Smith wrote: > > Hi Nisha. > > Here are some review comments for patch v6-0002. > Thanks for the review. All comments are addressed in v7. Please find responses below for a few of the comments. > > EXCEPT > > 5. > + > + EXCEPT ( class=3D"parameter">except_table_object [, ... ] > ) > + > + > + Specifies tables to be excluded from a schema-level publication en= try. > + This clause may be used with ADD TABLES IN SCHEMA > + and not with DROP TABLES IN SCHEMA. Each named > + table must belong to the schema specified in the same > + TABLES IN SCHEMA clause. Table names may be > + schema-qualified or unqualified; unqualified names are implicitly > + qualified with the schema named in the same clause. See > + for further details on t= he > + semantics of EXCEPT. > + > + > + > + > > 5a. > Oh! If this EXCEPT part was previously missing even for the "FOR ALL > TABLES", then IMO that is a separate bug that should be in another > thread and patched/fixed asap, then your patch should just make small > changes to to it. > Agree. I'll make a separate patch for it and start a thread. > =3D=3D=3D=3D=3D=3D > src/backend/commands/publicationcmds.c > > AlterPublicationSchemas: > > 7. > + /* > + * Increment the command counter so that is_schema_publication() in > + * GetExcludedPublicationTables() can see the just-inserted schema > + * rows when AlterPublicationExceptTables runs next. > + */ > + CommandCounterIncrement(); > > Should this cut/paste common code be done afterwards just if > stmt->action =3D=3D AP_AddObjects/SetObjects ? > Agree, fixed. > ~~~ > > AlterPublicationExceptTables: > > 8. > + /* > + * This function handles EXCEPT entries for schema-level publications > + * only. For FOR ALL TABLES publications, EXCEPT entries are already > + * processed by AlterPublicationTables(). > + */ > + if (schemaidlist =3D=3D NIL && !is_schema_publication(pubid)) > + return; > > Huh? It seems contrary to the function comment that was also talking > about "FOR ALL TABLES". > Corrected the function comments. It is for only schema publications. > Should this function really be called something different like > 'AlterPublicationSchemaExceptTables'? > Done. Renamed as suggested. > ~~~ > > 12. > + /* > + * For FOR ALL TABLES, EXCEPT entries are processed by > + * AlterPublicationTables(), so merge them in. For TABLES IN SCHEMA, > + * they are handled separately by AlterPublicationExceptTables(). > + */ > + if (stmt->for_all_tables) > + relations =3D list_concat(relations, exceptrelations); > AlterPublicationTables(stmt, tup, relations, pstate->p_sourcetext, > schemaidlist !=3D NIL); > AlterPublicationSchemas(stmt, tup, schemaidlist); > + AlterPublicationExceptTables(stmt, tup, exceptrelations, schemaidlist); > > Would it be simpler if AlterPublicationExceptTables was merged (or > delegated from) the AlterPublicationSchemas? > +1, fixed. -- Thanks, Nisha