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 1weTBY-004ov7-24 for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jun 2026 07:47:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1weTBX-0072M6-1U for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jun 2026 07:47:11 +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 1weTBX-0072Ly-0E for pgsql-hackers@lists.postgresql.org; Tue, 30 Jun 2026 07:47:11 +0000 Received: from mail-dy1-x1336.google.com ([2607:f8b0:4864:20::1336]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1weTBV-00000000stF-1EAM for pgsql-hackers@lists.postgresql.org; Tue, 30 Jun 2026 07:47:10 +0000 Received: by mail-dy1-x1336.google.com with SMTP id 5a478bee46e88-30e18c3e0b8so2736157eec.0 for ; Tue, 30 Jun 2026 00:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782805628; cv=none; d=google.com; s=arc-20260327; b=q0xMlS5TiUmeg5Tdx2H0iMtqbL5+F9Zs33W+dg94tWb/RqPwAuQ2JrS91SWp1rGfYI mDgibTmE7IQCR1SKTQFAWUydPypIYLn61Embrh9jUxdMHibJZuPw0B4vTT3BKEVdI49G KgGOitWqTtuS4qKwdKpCGbf91TWegn8wqrlG0aV+eA1hSggJukR0tnvt+P/lWRqYe2lJ 6CPo1t8dXVM7esmHYoDGHgVdfbjcI+ELlmv0fhanYg/qm49T7CeprIDmxwsiODGnBevD 9YjA6VJ5UUxOk/NZFIGLVFBMTZDoit63G0e0L5dEbvLVW6VRxgXgIUXkUhJ32bipLQaI r/YA== 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=pqY5ecCN5e6k9T6AS4KAMaM3qc1EBWdjT3HD8QRRQKc=; fh=IwDogN0gjP9SnaVZ1HWzPHFapWE51CD8Zx+LU7Azn2M=; b=bjHbyO4OwdzKpdRvrIP1dcwvygkBEW95oILOxCV38qqlZKXLWfNQ23E/BWBYpYSMWy NepxeBHmDKKq34pJCFRr+c7iI16BfnTVDmMk5q6NjERb7eobve73HKFovLHOHhqYbWcT RdYMOBe1dUua8WuwPBQI3phoS5oLDcVrqqwYtcXO+Trb84AnOPZln72oTq0x5BF3otyR avqY7CM9wh61sJbPLkV0Xb5VYru92HRmtNlfVsL1VqVcJQY6D6AatkXTwRRSOyyBbpm1 eoQejPrVSUJ7v4wcu6gH+8fiK2hfA3VmHEq71gbtMHLhWC7ux5XIhoHDehgm2xQJUe+x +wPQ==; 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=1782805628; x=1783410428; 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=pqY5ecCN5e6k9T6AS4KAMaM3qc1EBWdjT3HD8QRRQKc=; b=dSCvgSlXpC8C4/xTkBpkqDran/IwzL2Rw/ORvvU+eGFxu+Q0oonNfs+e25qtgWZERG QetbfiprQ/5C/l7/W/3NQhQYlmemVW5FZFJpvB3RD8Jf8A2SQA9kMYkvMgX3azZqSFGX j/KUV1cEZmFqMmWkxpKLPNO1R62jnWOoreETmOX9lW0m5//NCsj5JLHOfL2jLkp1ypU3 uUyvlt1gnB5VUUlFBaX3X69bGmnJtsaskZ7OopuJDsOJpT9zWAhCDQ/uiUVkbS7Tzy6f yBixdp3+Yw/3uTdSHMChowUhDKWtlgIP5BQfZ5ZFMXg0m8Llt3OmaaGk4HNXafnDcdGF 0b5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782805628; x=1783410428; 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=pqY5ecCN5e6k9T6AS4KAMaM3qc1EBWdjT3HD8QRRQKc=; b=dvr0KhlK2uxU8UCoX0vZmr9f6OfiSsK1tTyhvFwWXtbwoq4LyayNNirsnlixRpeUJ8 h7B1ixftdevWkyZQKkOrlxt78mibffEEEJvGEZmR/X9yH3PysXZIiMfvkpAFufv88hJx XE4D9Aq3LXS+A/tEhyTdgsVV/Z8wjEUlZKyimK4p0G/JG9/KDGtzs8YYfsRHFyexLoMn DmNQXSrTLSLZMLrZEBkKg6bNavkcIBBZ/ReKXk+VqpZqDbP/IedPhC+JeK4g40xVAfOV F0XevOaqgN5Fzh4+fdoVb8ELx7q6KTWMDB/svJ07ONO8Ds4xit27k0rdeMSWtrnGg2sk 0VEg== X-Forwarded-Encrypted: i=1; AHgh+Ro59KflLLAg5j3GtG8dCTjmmE+xP6PsHbo+s4L9xHbf8p3/Q1feL51mrZ6EhyUwyWfu+CiFV8ebluYft51b@lists.postgresql.org X-Gm-Message-State: AOJu0Yycf6HhhAXYSJoz8jL3rzkVsLmmIglTeqgJi7UZgbQIthdr7XJR XQZflN3RnRpB0V3gw0QG5f3nw2P77Z+7OsxQoo8do8GV2q77gHz5rt5KlySTz9UztPOrgGeLX5I jYNw0QoDsCLRnMlgmlgE+AbodluCC/54= X-Gm-Gg: AfdE7cnietBqIkh/aaqMFiFCjvOWvBXTjRJOE8Cn1U0VZPBHvclhQiPwhprgsawr9Ap x6LZo8lsI0zmDHxDadYaqd/1rpKKvsfncGxbjT6Dod+7WSNiZ79WZVVRlaFmqJ7SrioncnC9fAK VNJU4ZefLl7Ifjk8exsN/bu8afLiqiCf0ddkkmbwg2NvF8BqtZ7HBqHp0kmwlpuim4beYxUdhWg aetf3C+tdfPZ7wVT8JleI5IILJ+mQ6Kwdz+hV2rY77Y9EKiNJS/LqryCJhotwswRYoOdgDjfocw MuPSdhecAgunER1ueRqIKM+1c7+6ha1dnquxRg== X-Received: by 2002:a05:7301:5f16:b0:304:b93a:5107 with SMTP id 5a478bee46e88-30ee1409e45mr1949939eec.21.1782805628151; Tue, 30 Jun 2026 00:47:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ashutosh Sharma Date: Tue, 30 Jun 2026 13:16:53 +0530 X-Gm-Features: AVVi8Cd8x86IpwQJbp9L6tJ9TTbLFlxWRpbHUXcgtCM7uvwwn8EjBgiF7nvERjU Message-ID: Subject: Re: Support EXCEPT for ALL SEQUENCES publications To: Shlok Kyal Cc: Peter Smith , 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, On Tue, Jun 30, 2026 at 12:14=E2=80=AFPM Shlok Kyal wrote: > > On Mon, 29 Jun 2026 at 06:02, Peter Smith wrote: > > > > Hi Shlok. > > > > I only had one general comment about v14. IMO, it would be better to > > try to make the regression test object names more meaningful where > > possible (though sometimes it won't be). The xxx1, xxx2, and xxx3 > > become harder to read as more gets added. > > > > e.g. `regress_pub_seq3` -- What does 'pub' mean here? This is an > > unlogged sequence you want to exclude. > > e.g. `regress_pub_forallsequences4` -- Doesn't mean much. > > e.g. `tab_seq` -- This is meant to be a plain table; Not a table > > pretending to be a seq. > > > > Below is an example of some modifications, but there are many more. > > Consider checking all the names to see if they can be improved > > (sometimes you may be stuck having to accommodate existing names). > > (same comment applies to both patches). > > > > ~~~ > > > > BEFORE > > +-- fail - unlogged sequence is specified in EXCEPT sequence list > > +CREATE UNLOGGED SEQUENCE regress_pub_seq3; > > +CREATE PUBLICATION regress_pub_forallsequences4 FOR ALL SEQUENCES > > EXCEPT (SEQUENCE regress_pub_seq3); > > + > > +-- fail - temporary sequence is specified in EXCEPT sequence list > > +CREATE TEMPORARY SEQUENCE regress_pub_seq4; > > +CREATE PUBLICATION regress_pub_forallsequences4 FOR ALL SEQUENCES > > EXCEPT (SEQUENCE regress_pub_seq4); > > + > > +-- fail - sequence object is specified in EXCEPT table list > > +CREATE PUBLICATION regress_pub_forallsequences4 FOR ALL TABLES EXCEPT > > (TABLE regress_pub_seq0); > > + > > +-- fail - table object is specified in EXCEPT sequence list > > +CREATE TABLE tab_seq(a int); > > +CREATE PUBLICATION regress_pub_forallsequences4 FOR ALL SEQUENCES > > EXCEPT (SEQUENCE tab_seq); > > + > > > > > > SUGGESTION > > +-- fail - unlogged sequence is specified in EXCEPT sequence list > > +CREATE UNLOGGED SEQUENCE regress_seq_unlogged; > > +CREATE PUBLICATION regress_pub_should_fail FOR ALL SEQUENCES EXCEPT > > (SEQUENCE regress_seq_unlogged); > > + > > +-- fail - temporary sequence is specified in EXCEPT sequence list > > +CREATE TEMPORARY SEQUENCE regress_seq_temp; > > +CREATE PUBLICATION regress_pub_should_fail FOR ALL SEQUENCES EXCEPT > > (SEQUENCE regress_seq_temp); > > + > > +-- fail - sequence object is specified in EXCEPT table list > > +CREATE PUBLICATION regress_pub_should_fail FOR ALL TABLES EXCEPT > > (TABLE regress_seq1); > > + > > +-- fail - table object is specified in EXCEPT sequence list > > +CREATE TABLE tab1(a int); > > +CREATE PUBLICATION regress_pub_should_fail FOR ALL SEQUENCES EXCEPT > > (SEQUENCE tab1); > > + > > > I agree with your suggestions, I have made the changes. > I have also made changes for other objects as well in publication.sql > and 037_except.pl files. > > I also agree with the suggestions by Shveta in [1] and made the > required changes. > > Please find the updated v15 patch attached. > + /* TODO : Add a version check for PG 20 */ + if (pset.sversion >=3D 190000) + { + /* Get sequences in the EXCEPT clause for this publication */ + printfPQExpBuffer(&buf, "/* %s */\n", + _("Get sequences excluded by this publication")); + printfPQExpBuffer(&buf, + "SELECT n.nspname || '.' || c.relname\n" + "FROM pg_catalog.pg_class c\n" + " JOIN pg_catalog.pg_namespace n ON n.oid =3D c.relnamespace\n" + " JOIN pg_catalog.pg_publication_rel pr ON c.oid =3D pr.prrelid\n" + "WHERE pr.prpubid =3D '%s' AND pr.prexcept AND c.relkind =3D 'S'\n" + "ORDER BY 1", pubid); + if (!addFooterToPublicationDesc(&buf, _("Except sequences:"), + true, &cont)) + goto error_return; + } + } I've few questions related to above change: 1) Should the second printfPQExpBuffer() be appendPQExpBuffer()? As written, it overwrites the query comment added just above, so psql -E will not show "Get sequences excluded by this publication". 2) The above query may work on PG 19, but since the feature is going to be part of PG20, why do you want this query to be part of PG19? -- Do we also need to include a tap test for "ALTER PUBLICATION ... SET ALL SEQUENCES EXCEPT (...)" followed by "ALTER SUBSCRIPTION ... REFRESH SEQUENCES", and then sequence replication behavior is verified? -- With Regards, Ashutosh Sharma.