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 1wUCfT-0010aZ-0H for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jun 2026 00:07:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wUCfR-00BuXh-2T for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jun 2026 00:07:37 +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 1wUCfR-00BuXJ-1B for pgsql-hackers@lists.postgresql.org; Tue, 02 Jun 2026 00:07:37 +0000 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wUCfP-00000000etN-2Vap for pgsql-hackers@lists.postgresql.org; Tue, 02 Jun 2026 00:07:36 +0000 Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-5174a34800fso21193781cf.3 for ; Mon, 01 Jun 2026 17:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1780358855; cv=none; d=google.com; s=arc-20240605; b=EWo5xIbjGNkj3WZWvdIEXrQOYYj2mBg6qpBZtg9XXgCCgB9JirOnmLuDnYOGF0OkZ9 QsG/qzfybAs/OIuO98I1f8Urm9ZxEgoTJS816p4vQ/ousi9mOI/i2GUjvCAVHbYJvQSt u20csEt6/UFZu0tR3BMCt5IS30N6muWdrR0DO4ugznI3hrgP/9yo3Zfxagp7fiqrvuLy acPPJdQoco9ZIW8CDmApGYDkQxRXWCMsf5MK4FOkwMzZVUN+jkJJEGssq4tEUnCGQZor P+5U2I+ALbUqLv5+9ymIhVChlKe/mW+l17892P9eYFTFWz0GysoiFp+nOVOtGMWfDY0G tTlg== 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=ip8n/mmkJm28GU/IEkKcZICx7gIZGoRhDb9k+PbgvaA=; fh=aEAmTKMyYqmQflxnVYM2tmjz2bczfDzUdH6a8fNauao=; b=lsAk8zhZdo5HY9AHgv14tnCJY5dKP5l3BnygmxBVDvveAtzEy9ar122vVN5X0IsuNX IDk09wR88b30aLN0duiiVFxHCR9W2544g3hIHSK+R6e+i0JgH+O5lXb/S4gRL9p2DonT 75OABtXKEOC873Os3mYOC6wIeuyNektGWDw9CREudWc2/lnJQICcX5sZJgkfPmq3UGXe xyxXCOlbpTWsSGcaKFZfZxyxup7PyV65hq2aKyj1qoRdH2tREh8iUQPIYSoDYlZBNYpx fB2hGJKIfYYIgaLq78sqnVBndSWjLnOiVQHxemO07N6TBUUpQzJip4GPXUloSJwDprnU BqMQ==; 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=1780358855; x=1780963655; 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=ip8n/mmkJm28GU/IEkKcZICx7gIZGoRhDb9k+PbgvaA=; b=X45C4b39TUguimqf+wul52fJzA6VuglIlJpuKYmNywvXZlld8lSxUGYZplQnmc0eb4 o4Xrh42cGjJqLz0dQ7+NMb6aweza5EnVkp6XGQsR/gPBJPbiWOoD7ndfM0vGmaW8ws3A tbk4OI46kutICcVhP/PUU0nqul8Rf2c+6ZIRm4/l34wpe4sSlqc5gLdBTuKRNi5mUQop wwxsKwOHHs6sM6guibARcO6O6mkI262r4nToH/gwg/miJm5JyFVcUj7dr+/NKByiD8Jf 6orVg7twnq5r+ictu7rpmipiO1WpOJdLMrMezaOfgHLwVMuiZzSeDmxfUr91tk3syGsb bjLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780358855; x=1780963655; 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=ip8n/mmkJm28GU/IEkKcZICx7gIZGoRhDb9k+PbgvaA=; b=cT1XRmIPnoYDZ3yGhBJec+0f6ha6hD7BjqjAWZKoh9Xf9GiiQtbX21BZwBbAb8HCD7 uuLEHFjUE7xzxJTx/+AUaFUhyKsdmcjGn+xUKyU7xbcgxosoA3m9g9tMutoDxC6fqbNs 2tQLQTpuAUpOUzx6i8y/xZeg+ESjtvGGccGu6uzwL27S1hKbPV27IuTKi7GVMeiHpwxq M88q5phsF642qozzh74SjLosAPD1VGmjodttTpSYRB7D1sJPm1xpKfv6oTSvPsQNcX9T SDWq0sbZcW9+GDEvT/VOdSyTapZ+0dUJERiZuG6JZW39oh9Jj1ImSaLIAuf/WnbSaaZU ovww== X-Forwarded-Encrypted: i=1; AFNElJ9RBYvEpeeE37UF/LtLAA1f5WIGlvflP1iSah3f5q9cTqCr9PSaoRet2vFT2VRT+cRULCixaeqkU6d9S6ly@lists.postgresql.org X-Gm-Message-State: AOJu0Yw7DXY2h0RtCyVFWSSjCR+bftuoNmNtoKdxxAOXOUDM1NeJoOx9 19HxCa6vXe0HFfYc08R3bw2vuBzF6efSvzmv11ght0KypjRTUA2DAVC9+M6OJcfyU9y4tYyvSgs jtjW/x+oiPXbNoDkOkJ9SaazIP56Ghfs= X-Gm-Gg: Acq92OHPVKKnu5sUzHDqborGGxt9BNrz2SMrOXXqKVkHhEJiMLQLRao6Bu/WX/lcpxN pfYhGKNoU/E1rmLceNmRV0clKD1hRhdqqBJ8h7M0/syux+nMmAvfvZBhW/8tCRlk6F9OjpXocEr AH6X+ZSTuKmGw97qukX67AZ+AXWit+pqIIf+nG9gnb43vcKNS6uV7rFBdeb7J67tr3kVScO+6xy Fj7jnliXz13699iHruBRk9uuaXdWpnxytMotlZuby+GL+XZqgGNwcjUaM2zJJaVmN61lBqgi1pp /98EvDcT4a59WfADoN5tGZnaVZaL X-Received: by 2002:a05:622a:4811:b0:50f:b9e7:3031 with SMTP id d75a77b69052e-5173a5c0847mr196088331cf.7.1780358854627; Mon, 01 Jun 2026 17:07:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Tue, 2 Jun 2026 10:07:07 +1000 X-Gm-Features: AVHnY4Lhfwn1PGpubF5Zf6KJBSb8DTo1YyKCqP52c4jvufyxM_Pup_cwLIxNlyk Message-ID: Subject: Re: Support EXCEPT for ALL SEQUENCES publications To: Shlok Kyal Cc: shveta malik , vignesh C , 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 Hi Shlok, Some review comments for patch v8-0002. =3D=3D=3D=3D=3D=3D doc/src/sgml/ref/alter_publication.sgml Examples. 1. Everywhere in these example descriptions where you say "EXCEPT" or "ALL SEQUENCES" etc, those should all be using SGML markup. ~~~ 2. + + Replace the sequence list in the publication's EXCEPT clause: + +ALTER PUBLICATION mypublication SET ALL SEQUENCES EXCEPT (SEQUENCE seq1, s= eq2); + + + + Reset the publication to be a ALL SEQUENCES publication with no exclude= d + sequences: + +ALTER PUBLICATION mypublication SET ALL SEQUENCES; + 2a. Too wordy. /in the publication's EXCEPT clause/in the EXCEPT clause/ ~ 2b. The 1st example comment saying "Replace the..." doesn't really make sense because reading from top-to-bottom, this was not even publishing sequences. So, I think the "ALTER PUBLICATION mypublication SET ALL SEQUENCES EXCEPT (SEQUENCE seq1, seq2);" example should come *after* the "ALTER PUBLICATION mypublication SET ALL SEQUENCES;" example. ~~~ 3. + + Replace the table and sequence list in the publication's EXCEPT clause: + +ALTER PUBLICATION mypublication SET ALL TABLES EXCEPT (TABLE users, departments), ALL SEQUENCES EXCEPT (SEQUENCE seq1, seq2); Too wordy. Should be plural. /in the publication's EXCEPT clause:/in the EXCEPT clauses:/ =3D=3D=3D=3D=3D=3D src/backend/catalog/pg_publication.c GetIncludedPublicationRelations: On Wed, May 27, 2026 at 11:03=E2=80=AFPM Shlok Kyal wrote: > > On Wed, 27 May 2026 at 09:08, Peter Smith wrote: > > > > GetIncludedPublicationRelations: > > > > 4. > > /* > > * Gets list of relation oids that are associated with a publication. > > * > > * This should only be used FOR TABLE publications, the FOR ALL TABLES/= SEQUENCES > > * should use GetAllPublicationRelations(). > > */ > > List * > > GetIncludedPublicationRelations(Oid pubid, PublicationPartOpt pub_parto= pt) > > { > > Assert(!GetPublication(pubid)->alltables); > > > > return get_publication_relations(pubid, pub_partopt, false, RELKIND_REL= ATION); > > } > > > > The comment does not match the code/assert. Shouldn't it also do > > assert !allsequences? > > > This function can be called for ALL SEQUENCES publication. For example > 'pg_get_publication_tables', 'InvalidatePubRelSyncCache', etc can call > this function for all sequence publications, but in this case the list > returned is empty. So, there is no overall impact. > So, we should not add an 'assert !allsequences'. Hmm. The reply seems contrary to the function comment that says "This should only be used FOR TABLE publications", so if not going to add an Assert then doesn't the function comment need fixing? =3D=3D=3D=3D=3D=3D src/backend/commands/publicationcmds.c get_delete_rels: 5. /* - * Add or remove table to/from publication. + * Recreate list of tables/sequences to be dropped from the publication. + * To recreate the relation list for the publication, look for existing + * relations that do not need to be dropped. + * + * 'rels' contains the given list of relations, and 'oldrelids' contains + * the OIDs of existing relations in the publication identified by 'pubid'= . + */ Why say "recreate" everywhere? Can it just say "Returns the list of ...." instead of "Recreate ...". Also, I think this function comment needs to explain in more detail that this is called during ALTER SET. IIUC, the 'rels' is the reids you want to end up with in the publication; so those need to be compared with the 'oldrelids' to find which old ones are not wanted anymore. Those unwanted ones are what the function returns. ~~~ AlterPublicationRelations: 6. /* * Nothing to do if no objects, except in SET: for that it is quite - * possible that user has not specified any tables in which case we need - * to remove all the existing tables. + * possible that user has not specified any tables or sequences in which + * case we need to remove all the existing tables and sequences. */ Maybe this can be reworded more simply: SUGGESTION /* * Nothing to do if no objects were specified, unless this is a SET * command, which may need to remove all existing tables and sequences. */ =3D=3D=3D=3D=3D=3D Kind Regards, Peter Smith. Fujitsu Australia